replacing two EOL chars by one

From: Xah Lee (xah_at_xahlee.org)
Date: 12/20/03

  • Next message: Peter Seibel: "Re: lisp2wish extension?"
    Date: 20 Dec 2003 12:04:04 -0800
    
    

    i have a bunch of java files that has spaced-out formatting that i
    want to get rid of. I want to replace two end of line characters by
    one end of line characters. The files in question is unix, and i'm
    also working under unix, so i did:

     perl -pi'*~' -e "s@\n\n@\n@g" *.java

    but this to no avail.

    after many minutes of checking and rechecking and lots of trial and
    error with frustration, i realized that the fucking perl to my
    expectations again cannot do this simple fucking thing. Nor can the
    unix utility tr. Fucking stupid perl couldn't do a simple task of
    replacing strings.

    let me just take this opportunity to explain one *** from the
    thousands from perldoc.
    The following is a excerpt from perlre:

     m Treat string as multiple lines. That is, change "^" and "$" from
        matching the start or end of the string to matching the start or
    end
        of any line anywhere within the string.

     s Treat string as single line. That is, change "." to match any
        character whatsoever, even a newline, which normally it would not
        match.

    Note the first sentences of the two, which are logical opposites, but
    in fact they are sinister and not opposite at all. Fucking stupid perl
    documentation and Larry Wall moron who is i believe incapable of
    writing clearly and logically in English masquerading as humor.

    Now may i ask those who wallow in unix and perl: How do you do this?

    (if the answer is to write a more elaborate program in perl that
    explicitly open files and tread lines, please don't bother answering.
    Unix util answer also welcome. (this message is cross posted to python
    and scheme and ruby groups because i want them to know the
    incompetence and sham aspects of perl. (or my opinions thereof.)))

    Thanks.

     Xah
     xah@xahlee.org
     http://xahlee.org/PageTwo_dir/more.html


  • Next message: Peter Seibel: "Re: lisp2wish extension?"