Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!decwrl!decvax!dartvax!creare!was From: was@creare.UUCP (Wayne Smith) Newsgroups: comp.unix.questions Subject: Re: A little help with SED and embedded ^M please. Message-ID: <647@creare.UUCP> Date: 21 Apr 88 14:45:15 GMT References: <5483@sigi.Colorado.EDU> Reply-To: was@creare.UUCP (Wayne Smith) Distribution: na Organization: Creare, Inc. Hanover, NH Lines: 55 Summary: solutions In article <5483@sigi.Colorado.EDU> murillo@boulder.Colorado.EDU (Rodrigo Murillo) writes: >I have an SED problem (I think) and I would like to get som feedback >on how to do this. It is pretty trivial I think, but I am new to SED. > >I have a text file of this form: > > BEGIN > 1 > 2 > 3 > END > > BEGIN > 4 > 5 > 6 > END > >This goes on for about 200 records. What I want to do is extract the >numbers, in the same sequence as in the original, and write them out to >a new file. #!/bin/sh # Remove everything not between BEGIN and END sed -n -e '/^BEGIN$/!d :a n /^END$/d p b a' $1 >Also, I have recently had text files that have an emmbeded ^M char >at the end of every line. I know this has something to do with >CR/LF conversion. But how do I get rid of it? Thanks. sed 's/^M$//' (Note: the ^M is a single character. In vi or on the command line, type ^V^M to get the ^M into the text.) -Wayne Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. Ignore these lines. Seems my solution wasn't verbose enough for the mailer. -- Wayne A. Smith Creare Inc. arpa: was%creare%dartmouth.edu@relay.cs.net P.O. Box 71 uucp: dartvax!creare!was Hanover, NH 03755 phone: (603) 643-3800