Re: sed problem...simpler solution?
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 02/28/04
- Next message: Carlos J. G. Duarte: "Re: simple sed question: how to replace all but the last occurence of a pattern"
- Previous message: John W. Krahn: "Re: extracting information"
- In reply to: Carlos J. G. Duarte: "Re: sed problem...simpler solution?"
- Next in thread: Mike Chirico: "Re: sed problem...simpler solution?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 28 Feb 2004 01:28:19 GMT
On Sat, 28 Feb 2004 00:20:01 +0000, Carlos J. G. Duarte <cjgd@clix.pt> wrote:
>
>
> Mike Chirico wrote:
>> Using sed, how do I print contents between delimiters
>> <start> and <stop> if these delimiters sometimes occur on the same line?
>> It's ok to include <start> and <stop> in the output.
>
> 1. search for start
> 2. print
> 3. found stop? no: goto 2; yes goto 1
>
> sed -n '/<start>/!d; :b; p; /<stop>/d; n; bb'
>
A very nice script.
I learned a lot from studying it.
AC
- Next message: Carlos J. G. Duarte: "Re: simple sed question: how to replace all but the last occurence of a pattern"
- Previous message: John W. Krahn: "Re: extracting information"
- In reply to: Carlos J. G. Duarte: "Re: sed problem...simpler solution?"
- Next in thread: Mike Chirico: "Re: sed problem...simpler solution?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|