replacing two EOL chars by one
Jürgen Exner
jurgenex at hotmail.com
Sat Dec 20 16:18:41 EST 2003
More information about the Python-list mailing list
Sat Dec 20 16:18:41 EST 2003
- Previous message (by thread): Threads with Python 2.2.2 on Red Hat 9.0
- Next message (by thread): replacing two EOL chars by one
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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. > > 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
- Previous message (by thread): Threads with Python 2.2.2 on Red Hat 9.0
- Next message (by thread): replacing two EOL chars by one
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list