[Bug 195763] New: bsdgrep, empty matches and -o
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Sat Dec 6 23:35:11 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195763
Bug ID: 195763
Summary: bsdgrep, empty matches and -o
Product: Base System
Version: 10.1-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: dt71 at gmx.com
bsdgrep(1) behaves weirdly when, apparently, an empty (sub)string is matched.
=== a session on FreeBSD (10.1-RELEASE) begins ===
$ echo '01:1:01' | grep -Eo '(^|:)0*'
0
$ # hey, what gives?
$ echo '01:1:01' | bsdgrep -Eo '(^|:)0*'
0
:
:0
$ # ah, old bugz :}
$ echo '1:1:01' | grep -Eo '(^|:)0*'
$ # surely, this is the same bug
$ echo '1:1:01' | bsdgrep -Eo '(^|:)0*'
$ # wtf?
=== a session on FreeBSD (10.1-RELEASE) ends ===
OK, let's see Linux.
=== a session on a GNU/Linux distrubution begins ===
$ echo '01:1:01' | grep -Eo '(^|:)0*'
0
:
:0
$ # OK, just like BSD-grep
$ echo '1:1:01' | grep -Eo '(^|:)0*'
:
:0
$ # correct!
=== a session on a GNU/Linux distrubution ends ===
More testing:
=== a session on FreeBSD (10.1-RELEASE) begins ===
$ echo 'bla bla' | bsdgrep -Eo '[[:alnum:]]*'
bla
$ # ???
$ printf 'bla\nbla\n' | bsdgrep -Eo ''
bla
bla
$ # ...
=== a session on FreeBSD (10.1-RELEASE) ends ===
=== a session on a GNU/Linux distrubution ends ===
$ echo 'bla bla' | bsdgrep -Eo '[[:alnum:]]*'
bla
bla
$ # most sensible
$ printf 'bla\nbla\n' | bsdgrep -Eo ''
$ # also sensible
=== a session on a GNU/Linux distrubution ends ===
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list