[freebsd] On removing ^M

Matt Navarre mnavarre at cox.net
Sun May 8 12:53:07 PDT 2005


regisr wrote:
> On Sun, 08 May 2005 14:20:19 -0500
> "Fafa Hafiz Krantz" <fteg at london.com> wrote:
> 
> 
>>I am wondering what is needed (what tool or what code) to
>>do a mass (recursive) removal of ^Ms?
> 
> 
> try:
> tr -d "\r" < input-file > output-file
> 
> 

Or:
perl -pi -e 's/\015//' *.c

which will edit all .c files in place, or:

perl -pi.bak -e's/\015//' *.c

Which will also edit the files in place but leave the originial files 
with a .bak extension. Just a little easier to do on a whole directory 
of files than using tr.

OK,
Matt


More information about the freebsd-questions mailing list