Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'fixing Mac line breaks w/ PERL (MULTIPLE FILES)' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
fixing Mac line breaks w/ PERL (MULTIPLE FILES)
Authored by: mmarlett on Jan 02, '05 05:01:04PM

A somewhat more helpful (for me) version of this script reads like this:

######
#!/bin/sh
for filename in *.TXT
do
         echo $filename
         perl -pi -e 's/rn?/n/g' "$filename"
done
#######

The -li is unnecessary and the files I happen to want to deal with are of the TXT sort. However, * would cover everything as well.

The important change, though, is the quotes around $filename (or $T in the above example) so that file names with spaces in them are handled correctly by perl.

[ Reply to This | # ]