Deleting (Only) First Blank Line in File
Randal Schwartz
merlyn at iwarp.intel.com
Sun Jul 1 07:42:49 AEST 1990
In article <1651 at fallst.UUCP>, tkevans at fallst (Tim Evans) writes:
| Can someone help me to delete the _first_ occurring blank line of a file
| (whereever it occurs) without deleting subsequent ones?
|
| You'd think the following would work, but it doesn't:
|
| sed 's/^$//1' foo > newfoo
|
| Solutions other than those using 'perl' are preferred.
But, since you didn't say *necessary*, how about:
perl -ne 'print unless /^$/ && $once++;'
Easy, easy, easy.
Just another Perl hacker,
--
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III |
| merlyn at iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/
More information about the Comp.unix.questions
mailing list