Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!iwarp.intel.com!news From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: Deleting (Only) First Blank Line in File Message-ID: <1990Jun30.214249.15211@iwarp.intel.com> Date: 30 Jun 90 21:42:49 GMT References: <1651@fallst.UUCP> Sender: news@iwarp.intel.com Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: comp Organization: Stonehenge; netaccess via Intel, Beaverton, Oregon, USA Lines: 22 In-Reply-To: tkevans@fallst.UUCP (Tim Evans) In article <1651@fallst.UUCP>, tkevans@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@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/