[Bug 216362] New: grep is buggy
https://bugzilla.novell.com/show_bug.cgi?id=216362 Summary: grep is buggy Product: SUSE Linux 10.1 Version: Final Platform: All OS/Version: SuSE Linux 10.1 Status: NEW Severity: Major Priority: P5 - None Component: Basesystem AssignedTo: bnc-team-screening@forge.provo.novell.com ReportedBy: stepan@coresystems.de QAContact: qa@suse.de The man page says: grep -v, --invert-match Invert the sense of matching, to select non-matching lines. This option fails to work when used together with -A Now: grep -A4 /usr/include/sys/stat.h toke.info SF:/usr/include/sys/stat.h DA:436,571,A89D2KRy4P3ROgrzGe/VjQ LF:1 LH:1 end_of_record Let's invert this search and make sure those 5 lines are correctly cut out of the stream, as they are supposed to: grep -v -A4 /usr/include/sys/stat.h toke.info |grep -A4 /usr/include/sys/stat.h SF:/usr/include/sys/stat.h DA:436,571,A89D2KRy4P3ROgrzGe/VjQ LF:1 LH:1 end_of_record The second grep should eat up all output, as the first grep should filter exactly those 4 lines out. But it does not. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=216362 ------- Comment #1 from stepan@coresystems.de 2006-10-30 12:17 MST ------- Created an attachment (id=103079) --> (https://bugzilla.novell.com/attachment.cgi?id=103079&action=view) the file mentioned in the bug description -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=216362 mmarek@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID ------- Comment #2 from mmarek@novell.com 2006-10-30 14:03 MST ------- (In reply to comment #0)
The man page says:
grep -v, --invert-match Invert the sense of matching, to select non-matching lines.
This option fails to work when used together with -A
Now:
grep -A4 /usr/include/sys/stat.h toke.info SF:/usr/include/sys/stat.h DA:436,571,A89D2KRy4P3ROgrzGe/VjQ LF:1 LH:1 end_of_record
Let's invert this search and make sure those 5 lines are correctly cut out of the stream, as they are supposed to:
No they aren't. The four lines of context simply match the inverted regexp and the 'SF:/usr/include/sys/stat.h' will be printed because it's preceeded by a line that matches the inverted regexp. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=216362 ------- Comment #3 from mmarek@novell.com 2006-10-30 14:05 MST ------- What you need is sed: sed '\|/usr/include/sys/stat\.h|,+4 d' toke.info -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com