From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078728412202.tru64-unix-managers.marc@archive.invalid> From: "Christopher C. Stevenson" Date: Wed, 25 Nov 1998 22:49:15 +0000 To: tru64-unix-managers Subject: SUMMARY: embarassing/frustrating sed question X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078728412202 Greetings all -Just came back from supper, and the responses were so rapid that in my mailbox they're perfectly sequential (impressive!). The original question was how to substitute ^M's in a file with newlines. The most common (and direct) suggestion was almost unanimously to use tr '\015' '\012' < mac > unix or tr '\r' '\n' < mac > unix or slight variations thereof. It was rightly pointed out to me that sed is overkill (as the relative execution speeds will demonstrate). And how I managed to get through life without "tr" I'm still trying to fathom... Thanks to: + 131 Nov 25 Wallace, Lisa A. (3,160) RE: embarassing/frustrating sed quest + 132 Nov 25 Dr. Tom Blinn, 603 (2,744) Re: embarassing/frustrating sed quest + 133 Nov 25 Serguei Patchkovsk (1,450) Re: embarassing/frustrating sed quest + 134 Nov 25 Bugs Brouillard (2,882) Re: embarassing/frustrating sed quest + 136 Nov 25 Matt White (2,677) Re: embarassing/frustrating sed quest + 137 Nov 25 Jane Kramer (3,293) Re: embarassing/frustrating sed quest + 138 Nov 25 Richard L Jackson (3,474) Re: embarassing/frustrating sed quest + 139 Nov 25 Phil Farrell (2,913) Re: embarassing/frustrating sed quest + 140 Nov 25 Per Boussard, ERA/ (1,537) Re: embarassing/frustrating sed quest + 141 Nov 25 Roy Smith (1,760) Re: embarassing/frustrating sed quest Cheers Chris ====================================================================== Christopher C Stevenson C3004 office: (709) 737-2624 Dept. of Physics & Physical Oceanography fax: (709) 737-8739 Memorial University of Newfoundland St. John's, Newfoundland, CANADA A1B 3X7 URL: http://www.physics.mun.ca/~csteven ====================================================================== ---------- Forwarded message ---------- Date: Wed, 25 Nov 1998 17:54:44 -0330 (NST) From: Christopher C. Stevenson To: alpha-osf-managers@ornl.gov Followup-To: poster Subject: embarassing/frustrating sed question Greetings, Sed is not completely unknown to me, but today I tried using it to substitute newlines for ^M's in a Postscript printjob originating from a Mac (which has no linefeeds, causing things like 'awk' and 'vi' to choke on too-long lines if you try to manipulate them), and am having trouble getting sed to spit out literal \n's. This is under DU 4.0B. I first tried sed 's/^M/\n/g' mac.ps which substituted simple "n's". (Note that CTRL-V-CTRL-M is how you specify the literal ^M. Saddly, on this keyboard, I can't specify a literal LF). Then I tried a few more; sed 's/^M/"\010"/g' mac.ps -substitutes "010" for ^M's sed 's/^M/"\n"/g' mac.ps -"n" again sed s/^M/\\n/g mac.ps -and again... (etc) None of these work, I've run out of delimiters to try, any number of backslashes seem to be ignored, I can't seem to tell sed what character to print as I can (trivially) awk or echo by specifying "\123" whatever... there must be something I've missed. Any ideas at all? This is perhaps even more annoying because it should take only a moment to do, but now has me pulling my hair out. I'll summarize. Cheers Chris ====================================================================== Christopher C Stevenson C3004 office: (709) 737-2624 Dept. of Physics & Physical Oceanography fax: (709) 737-8739 Memorial University of Newfoundland St. John's, Newfoundland, CANADA A1B 3X7 URL: http://www.physics.mun.ca/~csteven ======================================================================