A set of functions to generate filenames, lines in files, lines in sub-sections of files, or count of lines that match an expression for each subsection within files.
The find takes a glob and finds all matching files.
Note
The find is recursive so it will match files in sub-folders as well.
find(glob[, start]) | Generates files matching the glob |
Example Use:
for name in find("*.iperf"):
print(name)
The concatenate generates all lines from files that match the given glob. It uses the find function so it is recursive.
concatenate(glob[, start]) | Generates lines from all files that match the glob. |
Example Use:
for line in concatenate('*csv'):
process(line)
Note
the idea behind the concatenate is that it allows you to process files that can be grouped by glob, e.g. all files that have cisco_1250 in their name
sections(glob, start, end[, top]) | Generates section generators |
The sections generator traverses lines from files matching the globs, yielding a generator of lines every time the regular-expression represting the start of the section is matched.
The section generator generates a subset of lines from an iterator, stopping when a line matches the regular expression representing an end-of-section line.
Traverses a sections within lines, yielding the count of lines that match the interesting regular expression for each section.