[wellylug] vi / ex question

jumbophut jumbophut at gmail.com
Tue Dec 7 16:02:28 NZDT 2004


On Tue, 7 Dec 2004 15:01:50 +1300, E.Chalaron wrote:
> How about sed ?
> 
> $ more file | sed '/ //g/' >  file_modified
> 
> make sure of the syntax.... because I am not...
> E
> 

I don't have a Linux box at work, but I think this is what you are after:

sed -e '/^$/d' filename > newfilename

or

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

Or this might work, but it seems less likely...

sed -e 's/^$//' filename > newfilename

The /g is not required with sed, since sed applies commands to every
line anyway.

In vim, prefix your command with a line range:

:a,b/^$/d

where a,b are the start and end line numbers respectively.  You can
use 1,$ for the whole file.

(Grant's e-mail gives an even more efficient solution in this case).

-- 
Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /l at omcgtjuba.phi/')




More information about the wellylug mailing list