On Mon, 12 Aug 2002, Bennett Todd wrote:

=>Elegant is in the eye of the beholder.
=>
=>I'd tend to use a pipeline
=>
=>      perl -lpe 's/\s+$//'|uniq
=>
=>but I'm sure others find other approaches more elegant. Mine is
=>admittedly not perl-only, but "|uniq" is probably quicker to type
=>than even a golf winner for eliminating extra blank lines. It does
=>have the weakness that it'll also eliminate duplicate non-blank
=>lines, that doesn't bother me, may make it a misfit for your job. I
=>suppose a canonical perl-only approach could start
=>
=>      perl -0777 -pe 's/[ \t]+\n/\n/g;s/\n{2,}/\n/g'
=>
=>or thereabouts (untested)
=>
=>-Bennett
Didn't there used to be (ages ago) a standard Unix util called rmb? It was 
a filter. No args. you'd do a 

rmb < fn > outfn

and it ReMoved all multiple occurances of Blank lines. Whatever happened 
to that?

-- 
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question? [EMAIL PROTECTED]


Reply via email to