I have a solution for this in awk
:
awk '{if (NR==1 && NF==0) next};1' somefile
but was unable to find one that worked in sed
. E.g.,
sed -i.bak '/^$/{1,1d;}' somefile
ended up deleting the first blank line it found (I'm not a sed
expert, so I was just trying out things). The advantage to sed
in this case is that I would be able to do this w/o temporary files. ie in place.
Best Answer
Try this one: