I am trying to write a rather brief sed script to delete the first two lines of a file only if they are empty, so the following file:
> cat myfile.in Line 3 Line 5
A file appears with three lines:
> cat myfile.out Line 3 Line 5
This has to do with string range combining and pattern matching, and I just can't find any examples. I would also be interested if anyone could offer and equally (or more) consult an alternative to Perl. Many thanks.
Footnote
I should add that I tried 1,2{/^$/d} , which worked fine on Linux, but on AIX I got:
sed: 0602-404 Function 1,2{/^$/d} cannot be parsed.
and on Solaris I got:
sed: command garbled: 1,2{/^$/d}
This is a hit because this code should work on both AIX and Solaris, but not Linux! Shame!
source share