If you want to redirect the output of a command used with -exec
, you need to execute a shell command. Moreover you'd need to redirect the output to a new file and move it back to the original filename.
Say:
find . -type f -exec sh -c 'tr -d "\r" < "{}" > "{}".new && mv "{}".new "{}"' -- {} \;
An alternate would be to use sed
:
find . -type f -exec sed -i 's/\r//' {} \;
or dos2unix
(as pointed out by kojiro):
find . -type f -exec dos2unix {} \;