(My brand new login - first time reporting a bug - apologies if...)
grep'ping for a byte offset always returns 0 for the result.
Searching "FreeBSD Bugzilla – Bug List" shows no other reports.
jonesy@nix5:~$ a='now is the time for all good men to come to the aid of the party'
jonesy@nix5:~$ echo $a | grep -b -o good
[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
(In reply to Marvin Jones from comment #0)
/usr/bin/grep in 13-current has the same bug.
gnugrep in ports/textproc works fine.
Thank you for the report.
I build WITH_BSD_GREP and it doesn't have this problem:
% grep --version
grep (BSD grep) 2.6.0-FreeBSD
% a='now is the time for all good men to come to the aid of the party'
% echo $a | grep -b -o good
The most likely fix for this in FreeBSD is to wrap up the rest of the work to make BSD_GREP the default.
Take, as this will go away with our future gnugrep retirement party.
I do recommend using bsdgrep if you specifically need a grep in base (and don't particularly need GNU extensions), or installing textproc/gnugrep for a less buggy version of a grep with GNU extensions.