Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: remove blank lines with regex

by Joost (Canon)
on May 21, 2002 at 13:35 UTC ( #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? | Other CB clients
Other Users?
Others surveying the Monastery: (1)
As of 2022-05-22 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (79 votes). Check out past polls.

    Notices?