Article View: comp.editors
Article #3542Re: Re^2: SED Question
From: Leo de Wit
Date: Thu, 13 Apr 1989 22:00
Date: Thu, 13 Apr 1989 22:00
54 lines
1322 bytes
1322 bytes
In article <2292@solo11.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
[]
|My first sed attempt can easily be fixed to handle partial matches at EOF
|properly:
|
|sed -n '
| /^PROMPT>$/{
| $p
| h
| n
| H
| /^>$/{
| $b eof
| n
| /^<$/b
| H
| }
| : eof
| g
| }
| p
|'
I think you'll need a third attempt 8-). It still doesn't handle correct
a series of lines like
PROMPT>
PROMPT>
>
<
or one like
PROMPT>
>
PROMPT>
>
<
Alternative:
sed -n '
: start
$p
$q
N
/^PROMPT>\n>\n<$/d
/\n[^\n]*\n/{
P
D
}
b start'
Leo.
Technical Details
Message-ID:
<1003@philmds.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!philmds!leoReferences:
<2360001@hpcuhc.HP.COM> <38564@bbn.COM> <2292@solo11.cs.vu.nl>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.editors,comp.unix.questions Subject: Re: Re^2: SED Question Keywords: sed, improvement, fix Message-ID: <1003@philmds.UUCP> Date: 13 Apr 89 22:00:08 GMT References: <2360001@hpcuhc.HP.COM> <38564@bbn.COM> <2292@solo11.cs.vu.nl> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 54