Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Re: remove blank lines with regex

by Joost (Canon)
on May 21, 2002 at 13:35 UTC ( [id://168119]=note: print w/replies, xml ) Need Help??


in reply to Re: remove blank lines with regex
in thread remove blank lines with regex

Do not slurp in a file into an array. Someday that input file will be huge.

I second that, and here is my 2-cent solution:

perl -wnl -e 'print $_ unless /^$/' infile >outfile

see also:

perldoc perlrun perldoc perlre
-- Joost downtime n. The period during which a system is error-free and immune from user input.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://168119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-29 13:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found