replacing two EOL chars by one

Xah Lee xah at xahlee.org
Sat Dec 20 21:04:04 CET 2003


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 at 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 shit 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 at xahlee.org
 http://xahlee.org/PageTwo_dir/more.html




More information about the Python-list mailing list