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.
Here are two Ruby solutions, both of which have Perl equivalents:
ruby -i~ -e ‘$/=nil; puts gets.gsub(/\n\n/,“\n”)’ *.java
ruby -i~ -e ‘$/=“\n\n”; while(gets)do puts chop end’ *.java
You may also want to check out http://astyle.sourceforge.net/
which is a free source code beautifier for C/C++/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. 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. […]
http://www.wavlist.com/movies/135/str-francis.wav
“Lighten up, Francis.”
Regards,
Bill
···
“Xah Lee” xah@xahlee.org wrote: