lsseq.py | ||
README.md |
lsseq
A simple filter utility for viewing long listings of text that have either repeating lines or sequential lines. Usage is similar to "uniq", except that in addition to condensing duplicates, it condenses runs of incrementing or decrementing numbered lines.
In order to be regarded as a run, lines must contain a single block of decimal numerals (with or without zero-padding), which increase by one step on each line. It does not matter if there are additional number blocks that don't change, and the changing number can appear anywhere in the line.
Although there is nothing about the program that requires it to be used on file listings, it was created to quickly asses PNG or EXR streams generated by Blender rendering processes.
Currently has no switches or controls, and very few features.
I also created it as a learning project for Eclipse/PyDev and integration with Github, so this is more of a learning project, although it is kind of handy.
Usage example:
$ ls my_pngstream*.png | lsseq
If the listing looks like this:
my_pngstream-f00001.png
my_pngstream-f00002.png
my_pngstream-f00003.png
my_pngstream-f00004.png
my_pngstream-f00005.png
my_pngstream-f00010.png
my_pngstream-f00012.png
The output will look like this:
my_pngstream-f00001.png
... (5) +
my_pngstream-f00005.png
my_pngstream-f00010.png
my_pngstream-f00012.png
For very long runs, this will be MUCH more compact and readable.
TODO
Would like to add option parsing and some options for ignoring parts of the input lines. This would be handy for use with "ls -l" for example, to ignore the changing filesize and data numbers, which would currently foul the run-detection.