[Chicago-talk] folding multiple newlines at eof

Jason Perkins jperkins at sneer.org
Tue Aug 16 08:00:44 PDT 2005


I'm attempting to convert runs of multiple newlines at the end of  
files into a single newline. The following one liner is converting  
all runs of newlines throughout the file to a single newline:

find . -name '*.php' -exec perl -00 -pi -e 's/\n{2,}$/\n/s' {} \;

Can anyone suggest a means of correcting the behaviour? Explanations  
with your fix even more greatly appreciated so that I can figure this  
out on my own next time.

thanks!




--
Jason Perkins
jperkins at sneer.org

"The computer allows you to make mistakes
faster than any other invention, with the
possible exception of handguns and tequila."













More information about the Chicago-talk mailing list