grep -b, --byte-offset returns 0

Kyle Evans kevans at freebsd.org
Fri Jan 31 18:06:09 UTC 2020


On Fri, Jan 31, 2020 at 12:03 PM Jonesy via freebsd-questions
<freebsd-questions at freebsd.org> wrote:
>
> (I'm not sure if I can post to this list via nntp/gmane...)
>
> grep'ping for a byte offset always returns 0 for the result.
> Searching "FreeBSD Bugzilla – Bug List" shows no other reports.
>
> Ubuntu 16.04:
>
> jonesy at nix5:~$ a='now is the time for all good men to come to the aid of the party'
> jonesy at nix5:~$ echo $a | grep -b -o  good
> 24:good
>
>
> FreeBSD 12.1
>
> [jonz~]a='now is the time for all good men to come to the aid of the party'
> [jonz~]echo $a | grep -b -o  good
> 0:good
>
> I have just now created a login at bugs.freebsd.org/bugzilla/
> and reported this bug there, but I am unsure if I did it all
> correctly.   :-)
>
> Can someone confirm my findings?

I can confirm:

# echo 'now is the time for all good men to come to the aid of the
party'  | gnugrep -bo good
0:good

This is a non-issue in bsdgrep, FWIW:

# echo 'now is the time for all good men to come to the aid of the
party'  | bsdgrep -bo good
24:good

I hope to soon find more time to push us closer towards a bsdgrep
default, because gnugrep does not look good on us in many cases. =-(

Thanks,

Kyle Evans


More information about the freebsd-questions mailing list