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

Perl one liner

by viktor (Acolyte)
on Aug 08, 2011 at 19:40 UTC ( #919311=perlquestion: print w/ replies, xml ) Need Help??
viktor has asked for the wisdom of the Perl Monks concerning the following question:

Is there a one liner to merge say three new lines (blank lines )in one new (blank) line in perl.

Comment on Perl one liner
Re: Perl one liner
by Anonymous Monk on Aug 08, 2011 at 19:44 UTC
    No, you'll have to write it :)
Re: Perl one liner
by BrowserUk (Pope) on Aug 08, 2011 at 19:55 UTC

    C:\test>type junk.dat 1 2 3 4 5 C:\test>perl -00 -pe1 junk.dat > junk.out C:\test>type junk.out 1 2 3 4 5

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Perl one liner
by JavaFan (Canon) on Aug 08, 2011 at 20:02 UTC
    Untested:
    perl -i -0777 -pe 's/\n\n\n/\n/g' your-file

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://919311]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2014-08-31 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (294 votes), past polls