replacing two EOL chars by one
Jay Tilton
tiltonj at erols.com
Sat Dec 20 16:36:48 EST 2003
xah at xahlee.org (Xah Lee) wrote:
: 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.
Of course it's not.
Perl's -p switch processes one line at a time. A line cannot have more
than one newline character.
Perl's "paragraph" reading might be useful to you, where any number of
consecutive newline characters mark the end of a record. See "$/" in
perlvar for details.
perl -i'*~' -lpe "BEGIN{$/=''}" *.java
: 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.
Complete nonsense. Don't blame your own incompetence on Perl.
: Fucking stupid perl
: documentation and Larry Wall moron who is i believe incapable of
: writing clearly and logically in English masquerading as humor.
If you feel you can explaint it more clearly, quit bellyaching about it and
submit a documentation patch.
Preferrably one that is less petulant and profane than your article.
Frustration is no excuse for incivility.
More information about the Python-list
mailing list