Nano-and-Weird Blank Lines?

Tim Chase blinux.list at thechases.com
Fri Jul 31 02:38:36 UTC 2009


Hart Larry wrote:
> Well, back on January 08, 2008 Tim gave me a quite helpful command to get rid 
> of blank lines, useing sed.  Most times it works quite well, however, when I 
> try-and-edit an article from the printer friendly version of Time Magazine, 
> these sample supposedly blank lines will not go away.

The previous sed command can be tweaked:

   sed '/^[ \t*]*$/d' in_file.txt > out_file.txt

You can add characters to the set of characters to disregard.  In 
the above, it's a space, a yab (\t) and an asterisk.

Or you can just use it as a pipe:

   lynx -dump http://example.com | sed '/^[ \t*]*$/d' > out.txt

-tim






More information about the Blinux-list mailing list