Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
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 chilling in the Monastery: (7)
As of 2014-08-01 01:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (256 votes), past polls