Grep --byte-offset
does not return offset (Grep version 2.5.1) Hello, I'm trying to get the position of a repeating line in a line using
the code:
grep -b -o "pattern"
On my server I use GNU grep version 2.14 and the code works fine. However, when I deploy the same code on another server that uses GNU grep version 2.5.1, the code does not work correctly. Despite the fact that there is a byte offset option. Any idea how to solve it.
Example:
the code:
export string="abc cat mat rat cat bat cat fat rat tat tat cat" echo $string|grep -b -o "cat"
Expected Result (and supported in grep 2.14):
4:cat 16:cat 24:cat 44:cat
But the same code with grep version 2.5.1 gives the following output:
0:cat cat cat cat
Please suggest ..
source share