Re^2: SED Question
Leo de Wit
leo at philmds.UUCP
Fri Apr 14 08:00:08 AEST 1989
In article <2292 at solo11.cs.vu.nl> maart at 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.
More information about the Comp.unix.questions
mailing list