[wellylug] vi / ex question

Andrew Childs achilds at orcon.net.nz
Tue Dec 7 16:12:57 NZDT 2004


> sed -e '/^$/d' filename > newfilename
> 
> or
> 
> sed -n -e '/^..*$/p' filename > newfilename

or

sed -i -e 's/^$//' filename

The problem with this is that (as you point out) sed works on each line seperately. This means that it will match every empty line and replace it with an empty line. I'm not sure of the way around this.

--
Andrew




More information about the wellylug mailing list