[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed: must do append before delete?
From: |
Andreas Schwab |
Subject: |
Re: sed: must do append before delete? |
Date: |
08 Oct 2001 18:42:41 +0200 |
User-agent: |
Gnus/5.090003 (Oort Gnus v0.03) Emacs/21.0.107 |
address@hidden (Dan Jacobson) writes:
|> Interesting, very interesting, where is the logic to defend:
|>
|> $ yes|sed 2q|sed '$d;$a\
|> > hello'
|> y
|> $ yes|sed 2q|sed '$a\
|> > hello
|> > $d'
|> y
|> hello
|> $ sed --version
|> GNU sed version 3.02
|>
|> seems backwards to me. I delete the line and then write something
|> there, instead that something gets deleted. Instead I write something
|> there and then delete that line and instead it stays. Using the i
|> command instead of the a command one gets the same results. Using
|> s/.*// instead of d allows the hello thru though...
I'd guess the logic is that $d causes the address $ to not exist any more,
so that $a is not executed. Like this:
$ yes|sed 2q|sed '1d;1a\
> hello'
y
Andreas.
--
Andreas Schwab "And now for something
address@hidden completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5