> 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