> Hi, I found that "grep -b" doesn't work on my machine. the expected > result for below command is "7:not", but I got 0 $ echo gnu is not > unix | grep -b -o "not" 0:not Bash version 3.2.25 Linux version 2.6.18
What is version of your grep? I trid your test case on CentOS 5.10, and I got the same results as you. As the bug was fixed in grep 2.6, it does not occur in grep 2.20 which is most recently version. $ uname -a Linux cent58 2.6.18-371.el5 #1 SMP Tue Oct 1 08:37:57 EDT 2013 i386 i386 i386 GNU/Linux $ bash --version GNU bash, version 3.2.25(1)-release (i386-redhat-linux-gnu) ........ $ cat /etc/redhat-release CentOS release 5.10 (Final) $ echo gnu is not unix | env LC_ALL=C /bin/grep -b -o "not" 0:not $ env LC_ALL=C /bin/grep --version grep (GNU grep) 2.5.1 ........ $ echo gnu is not unix | env LC_ALL=C grep -b -o "not" 7:not $ env LC_ALL=C grep --version grep (GNU grep) 2.20 ........ Written by Mike Haertel and others, see <http://git.sv.gnu.org/cgit/grep.git/tree/AUTHORS>.
