Re: sed 4.2.1 bug
Sophia Jacob <[email protected]>
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <CAOsEXdduj7DSeD9+L5nRCQnHr9Firx9j7roOPM5mJXJtsCH2uA@mail.gmail.com> |
Oh! ok. Thank you very much!! Sophia On 7/11/12, Davide Brini <[email protected]> wrote: > On Tue, 10 Jul 2012 22:31:32 +0530, Sophia Jacob <[email protected]> > 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. >