ron@woan.austin.ibm.com (Ronald S. Woan/2113674) (02/01/90)
In article <5622@udccvax1.acs.udel.EDU>, william@vax1.acs.udel.EDU (Wi 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? The "^M's" are a result of Microsoft's brain damaged decision to use CR/LF to signify end-of-lines. They can be canned by using the delete function of the standard "tr" command. I forget for the moment the hex representation of "^M", but you can look it up in any standard ASCII table. Alternatively, use kermit or zmodem to upload with the text option that will automatically strip "^M" going up or add them when downloading. I would recommend zmodem for its "on-the-fly" compression of text as well. Ron +-----All Views Expressed Are My Own And Are Not Necessarily Shared By------+ +------------------------------My Employer----------------------------------+ + Ronald S. Woan (IBM VNET)WOAN AT AUSTIN, (AUSTIN)ron@woan.austin.ibm.com + + outside of IBM @cs.utexas.edu:ibmaus!auschs!woan.austin.ibm.com!ron + + last resort woan@peyote.cactus.org +
jik@athena.mit.edu (Jonathan I. Kamens) (02/02/90)
In article <5622@udccvax1.acs.udel.EDU>, william@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710
kleonard@gvlv2.GVL.Unisys.COM (Ken Leonard) (02/02/90)
In article <5622@udccvax1.acs.udel.EDU> william@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?
you have (at least) two alternatives:
--use the mode of your file-transfer program that understands that you
..are sending a "text" file: the *DOS and *NIX ends should take care of
..end-of-line sequences (_most_ XMODEM, YMODEM and KERMIT implementations
..do this)
--use WP to save "without line breaks" or whatever the incantation is
..actually called
----------------
regardz,
Ken
merlyn@iwarp.intel.com (Randal Schwartz) (02/02/90)
In article <1990Feb1.164704.23581@athena.mit.edu>, jik@athena (Jonathan I. Kamens) writes: | tr -d "\012" < filename > filename.new Bzzzt. Can't combine that sorta quoting. tr will get '012' as an argument, not '\012', so what you wanted was either: "\\012" or '\012' Durn shell quotes. :-) Just another oft-quoted source, -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/
jik@athena.mit.edu (Jonathan I. Kamens) (02/02/90)
In article <1990Feb1.193031.11699@iwarp.intel.com>, merlyn@iwarp.intel.com (Randal Schwartz) writes: > Bzzzt. Can't combine that sorta quoting. tr will get '012' as an > argument, not '\012', so what you wanted was either: > "\\012" > or > '\012' Oh, really? In csh: % cat testfile line 1 line 2 % tr -d "\012" < testfile line 1line 2% tr -d '\012' < testfile line 1line 2% In sh: $ tr -d "\012" < testfile line 1line 2$ tr -d '\012' < testfile line 1line 2$ More relevantly (once again, in csh): % echo \012 012 % echo "\012" \012 % echo '\012' \012 % So, what were you saying, Randal? :-) Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (02/02/90)
In article <1990Feb1.164704.23581@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
: tr -d "\012" < filename > filename.new
That will delete line feeds. You wanted
tr -d "\015" < filename > filename.new
Since the original poster is already using vi, it's easier to say
:%s/^V^M//
Larry Wall
lwall@jpl-devvax.jpl.nasa.gov
merlyn@iwarp.intel.com (Randal Schwartz) (02/02/90)
In article <1990Feb1.212333.7495@athena.mit.edu>, jik@athena (Jonathan I. Kamens) writes: | So, what were you saying, Randal? :-) I was hallucinating. The drugs must've wore off. Actually, I was thinking of troff, and expecting the shells to be compatible. How stupid. How embarrassing. At least I didn't rewrite it in Perl :-). (But then, I would have got it right. :-) Just another person posting before testing (join the crowd...), -- /=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\ | on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn | \=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/
decot@hpisod2.HP.COM (Dave Decot) (02/02/90)
> 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? > > Any help would be appreciated. > > William@vax1.udel.edu While in vi, type: :g/^V^M/s///g^M (where ^V represents typing control-V and ^M represents typing control-M). Dave
mvp@v7fs1.UUCP (Mike Van Pelt) (02/02/90)
In article <5622@udccvax1.acs.udel.EDU> william@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? If you just want a way to do this in vi, I use the following all the time: :s/^M//g The trick is getting the ^M in the search string. You do this by pressing <CONTROL>-V, followed by carriage return or <CONTROL>-M. ^V is vi's quoting character. -- Mike Van Pelt "I'm not a biologist, but I play one in Headland Technology/Video 7 front of Congressional hearings." ...ames!vsi1!v7fs1!mvp -- Meryl Streep
breck@aimt.UU.NET (Robert Breckinridge Beatie) (02/02/90)
In article <1990Feb1.193031.11699@iwarp.intel.com>, merlyn@iwarp.intel.com (Randal Schwartz) writes: > In article <1990Feb1.164704.23581@athena.mit.edu>, jik@athena (Jonathan I. Kamens) writes: > | tr -d "\012" < filename > filename.new > > Bzzzt. Can't combine that sorta quoting. tr will get '012' as an > argument, not '\012', so what you wanted was either: > "\\012" > or > '\012' Well, I've been wrong before, so I might be wrong now. But, isn't '\012' the same as '\n' or the new-line character? Didn't the original poster want to know how to strip '^M' or carriage-return characters from his uploaded files? Shouldn't he be coing a: tr -d '\015' < filename > filename.new ? -- Breck Beatie (408)748-8649 {uunet,ames!coherent}!aimt!breck OR breck@aimt.uu.net "2 does not equal 3. Not even for very large values of 2." - Roy Smith
jik@athena.mit.edu (Jonathan I. Kamens) (02/02/90)
In article <6965@jpl-devvax.JPL.NASA.GOV>, lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: > Since the original poster is already using vi, it's easier to say > > :%s/^V^M// Oh, so *that's* how you do it :-) Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710
tim@ncrcan.Toronto.NCR.COM (Tim Nelson) (02/02/90)
In article <5622@udccvax1.acs.udel.EDU> william@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? vi: %s/.$/ g/^V^M$/s/// sed: sed 's/.$//' infile >outfile tr: tr -d '\15' <infile >outfile Any of these should work. ===== tim nelson | uucp ...!uunet!attcan!ncrcan!tim ncr canada | internet Tim.Nelson@Toronto.NCR.COM (416) 826-9000 | 6865 Century Ave, Mississauga, Ontario, Canada L5N 2E2 ===== * Have a good day, and a great forever! * What?
dave@dsachg1.UUCP (Dave Pridgen) (02/03/90)
From article <5622@udccvax1.acs.udel.EDU>, by william@vax1.acs.udel.EDU (William H. York): > 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? > > Any help would be appreciated. > > William@vax1.udel.edu Your upload protocol should remove the <carriage return> characters for you since they are not used in unix (unix uses the newline character). You have many choices: switch to a protocol that strips the <cr>, or use any of the Unix filter programs. Here is one written in tr. -- tr -d '\015' Just pipe your file through that. and that should solve your problem. David Pridgen Unify Corporation Site Consultant My opinions are my own.
res@cbnewsc.ATT.COM (Rich Strebendt) (02/04/90)
In article <5622@udccvax1.acs.udel.EDU>, william@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? This is such a trivial problem, I expect to see at least 75000 replies saying the same thing: Type in the command :%s/^V^M$// where ^V is the CNTL-V combination, and ^M is the CNTL-M combination. When you type the ^V, the character ^ will appear on the command line. When you next type the ^M, the string ^M will replace the ^ character. I suggest a session reading the vi manual and/or man pages. Rich Strebendt ...!att!ihlpb!res
ask@cbnews.ATT.COM (Arthur S. Kamlet) (02/07/90)
In article <1990Feb1.164704.23581@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes: >In article <5622@udccvax1.acs.udel.EDU>, william@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? > I don't know how to do it in vi; I use emacs :-) ("M-x replace-string ><RETURN> ^Q ^M <RETURN> <RETURN>"). In vi, do this: :g/^V^M/s/// The <control>-V allows you to enter the <control>-M in the ex command -- Art Kamlet a_s_kamlet@att.com AT&T Bell Laboratories, Columbus