in reply to Re: Recursive File Substitution
in thread Recursive File Substitution

find . -type f -print | xargs perl -pi -e 's/\r//g'

Replies are listed 'Best First'.
Re: Recursive File Substitution
by hacker (Priest) on Jul 12, 2002 at 12:48 UTC
    ..slightly different:
    perl -pi.orig -e 's/\cM//g' `find . -type f`
      That's not going to work if you have filenames with spaces in them. Piping it through xargs -0 (and don't forget the -print0 option for find) works better, although you will still have problems with filenames ending or beginning with a pipe symbol, beginning with a greater than or less than symbol, files named -, or files beginning or ending with whitespace. All due to the magic open (All hail magic open!).

      We can however do the substitution without a body:

      find . -type f -print0 | xargs -0 perl -0777lpwi.bak -015e' '

      Abigail

      You mean that this little bitty one liner does everything that the huge program above does?