From: Vincent.D'Antonio@bisys.com
Subject: SUMMARY: remove ^M from a file
Date: Fri, 10 May 2002 16:07:48 -0400 [thread overview]
Message-ID: <OF69247714.53F4327B-ON85256BB5.006CCE1C@bps.com> (raw)
WOW, I received responds faster then my own mail was sent to me ( which I
am still waiting to see ). Here are some replies.
thanks to:
Tripathi, Ashish cat file | col -b > new file name
Phil Farrell The simplest way I know is to use "tr" to delete the CTRL-M
characters,
using the octal code from the ASCII chart to specify it, for example,
tr -d '\015' < original_file > new_fixed_copy
Ballowe, Charles cat <file> | sed -e 's/Ctrl-vCtrl-m//' >> <file>.new ;
mv <file>.new <file>
Paul A Sand I use:
perl -pi -e 's/\r//g;' filename
(Removes them everywhere)
If you want them replaced with Unix newlines:
perl -pi -e 's/\r/\n/g;' filename
I think there's probably a way to do it with sed too.
Kurt A. Ludwig there should be a utility called dos2unix that will take
care of it.
Peter Mittermayer, and Xavier Mertens sed "s/^M$//g" <infile >outfile
John Venier # tr -d '\r' < oldfile > newfile
?
Warning: this does not limit the removal of the ^M to the ends of
lines; it removes all of them.
plus many more, I thank all who replied.
thanks again
Vince
---------------------------------------------------------------------------------------------------------
Vincent D'Antonio
Unix Systems Engineer
Bisys Retirement Services
200 Dryden Road
Dresher, PA 19025
phone: 215-542-2555
fax: 215-542-2603
e-mail: Vincent.D'Antonio@bisys.com
reply other threads:[~2002-05-10 20:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox