[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sed 4.2.1 bug
From: |
Davide Brini |
Subject: |
Re: sed 4.2.1 bug |
Date: |
Wed, 11 Jul 2012 12:45:36 +0200 |
On Tue, 10 Jul 2012 22:31:32 +0530, Sophia Jacob <address@hidden>
wrote:
> Thank you very much Paolo!
>
> Still it looks like 'D' is not working at all in this case. I ran this:
> $ sed -n '=;i\
> ----
> ;p;H;4,${g;i\
> +++
> ;=;D;h}' c # c is the same file that contains 5 lines 1\n2\n3\n4\n5
>
> (Print the pattern space at the beginning of the command. So, if 'D'
> deletes the first segment of the pattern space (which will contain
> "1\n2\n3\n4\n", in the next itteration, 'p' should be printing
> "2\n3\n\4". But it keeps printing "1\n2\n3\n4"!
At line 4 the hold space (which is copied to the pattern space by the "g"
command) contains
\n1\n2\n3\n4
note the leading \n. This, the "D" command only deletes the first \n,
leaving 1\n2\n3\n4.
--
D.