Getting a text file rid of all superfluous blank lines

Paul Smith phhs80 at gmail.com
Thu Dec 1 23:30:31 UTC 2005


On 12/1/05, Les Mikesell <lesmikesell at gmail.com> wrote:
> > > sed -e 's;^\w*$;;' file-to-clean | grep -v '^$'
> >
> > Why not use egrep to do it in one pass? Something like:
> >
> > egrep -v '^\w*$' file-to-clean
>
> Neither of these leave any blank lines.  The idea was
> to collapse repeated blank lines or lines containing only
> white space to one.

So many ways of solving my problem show that this list is quite creative!

Paul




More information about the users mailing list