Re: automatically deleting ^M on text files
t s a d i <ch4di@yahoo.com> writes:
> i have a truckload oftext files (.html) that i need to edit and it
> has the character "^M" all over it (caused when someone uploads a text
> file and the ftp transfer is set to binary).
>
> does anyone know of a way to automate this ?
At your shell prompt do:
for file in *; do
mv $file $file.old
tr -d '\015' < $file.old > $file && rm $file.old
done
The '\015' is octal for CTRL-M (^M).
--
Olaf Meeuwissen Epson Kowa Corporation, Research and Development
Reply to: