From: "Jürgen Exner" Date: 2003-12-21T06:21:55+09:00 Subject: Re: replacing two EOL chars by one 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@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. [rest of rant snipped] Five seconds of thinking might have spared you from embarassing yourself like that (and is certainly more effective than 5 paragraphs of swearing). You are reading the file line by line. And with each line you are looking for two consecutive newlines. Now, how can a single line contain two newlines? jue