Squeeze multiple blank lines to one

March 10th, 2007 toydi Posted in cat, lpr, Text Manipulation, tr | Hits: 51500 | No Comments »

Documents like RFCs may contain many blank-line blocks.

To save the trees, i always squeeze multiple blank lines down to single blank line, before printing.

Once I did this manually (yes, it’s like hell), but now I use cat -s:

cat -s rfc2324.txt | tr -d '\\f' | lpr

I use tr -d to remove any form feed character, and lpr will submit the document for printing.

Leave a Reply