^M 's in uploaded text files.
Jonathan I. Kamens
jik at athena.mit.edu
Fri Feb 2 03:47:04 AEST 1990
In article <5622 at udccvax1.acs.udel.EDU>, william at vax1.acs.udel.EDU
(William H. York) writes:
> I use my PC to write text files in word perfect then I save in dos format
> to upload to our vax. When the file is cat'ed, the ^M's don't show, but
> when vi'ing they become real annoying! Is there a file I can pipe it
> through to remove the ^M's or perhaps a way vi can be used to remove them?
Many versions of the "tr" program will allow you to specify control
characters in the strings passed to tr, and to use the -d option to tell
it to delete any characters in the first string. Therefore, to delete
all the ^M characters in a file, you could do
tr -d "\012" < filename > filename.new
Note that your version of tr may require that you use "[\012]" instead
of just "\012".
I don't know how to do it in vi; I use emacs :-) ("M-x replace-string
<RETURN> ^Q ^M <RETURN> <RETURN>").
Jonathan Kamens USnail:
MIT Project Athena 11 Ashford Terrace
jik at Athena.MIT.EDU Allston, MA 02134
Office: 617-253-8495 Home: 617-782-0710
More information about the Comp.unix.questions
mailing list