By Malcolm McLean homepage

loselong is a simple utility to filter out long lines from files for reading.

Often when you're running tools on automatically generated files, the lines are so long that they are impossible to read, and clog up the output. loselong filters out all long lines above a certainthreshold.

The usage is simple:

loselong infile.txt

will filter all lines above 80 characters from infile.txt, replacing them with an 80-character line with an ellipsis in the middle of it.

Running the program without the filename tells it to read from stdin, so you can use it in a pipe environment.

grep -r pattern | loselong

This would be typical use. It greps a list of files for pattern, then shortens the long lines for human viewing.

You can of course set the line wdith with the -w option (80 characters is the default)

loselong -w 120

You can also set the -s option to suppress rather than shorten long lines.

loselong -s

This does the same as loselong, but now lines over 80 characters are totally eliminated.

There's also a -h or -help option to display a usage message.