[Bug 1867] New: sed: 'N' command followed by 'd' produces strange behaviour on subsequent lines

bugzilla at busybox.net bugzilla at busybox.net
Sun May 30 15:13:19 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=1867

           Summary: sed: 'N' command followed by 'd' produces strange
                    behaviour on subsequent lines
           Product: Busybox
           Version: 1.16.x
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: spb at exherbo.org
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


$ echo -e "a\nb\nc\nd" | busybox sed -n '1{N;N;d};2p;3p;4p'
d
d
d

As far as I can tell, on line 1 an 'N' command will result in subsequent
address matches for this line matching against both line 1 and line 2; two 'N'
commands result in addresses for line 1, 2 and 3 all matching. This much seems
reasonable, though I'm not sure what the standard says about it. GNU sed at
least will match only line 3 in this situation (the above sed script prints
only one "d").

However, following a 'd' command in the same block, this results in the next
execution of the script, on input line 4, matching commands for lines 2, 3 and
4. This seems wrong.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list