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.

Replies are listed 'Best First'.
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
Re: Perl one liner
by BrowserUk (Patriarch) 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 Anonymous Monk on Aug 08, 2011 at 19:44 UTC
    No, you'll have to write it :)