Grep --byte-offset not returning the offset (Grep version 2.5.1)

Hi,
I am trying to get the position of a repeated string in a line using

grep -b -o "pattern"

In my server I am using GNU grep version 2.14 and the code is working fine. However when I am deploying the same code in a different server which is using GNU grep version 2.5.1 the code is not working properly. Even though the byte offset option is available there. Any idea how to solve it.

Example:

export string="abc cat mat rat cat bat cat fat rat tat tat cat"
echo $string|grep -b -o "cat"

Expected output (and supported in grep 2.14):

4:cat
16:cat
24:cat
44:cat

But same code with grep version 2.5.1 is giving the following output:

0:cat
cat
cat
cat

Please suggest..

Could it be that the 2.5.1 version is BSD grep? What is the output of

grep --version

In GNU grep 2.14 and 2.6.3 I get:

4:cat
16:cat
24:cat
44:cat

Byte offset can be problematic in an UTF locale.
Does it work after

export LC_ALL=C

?

-- It doesnt show anything as BSD. it shows GNU grep version 2.5.1

---------- Post updated at 01:52 PM ---------- Previous update was at 01:52 PM ----------

---------- Post updated at 01:54 PM ---------- Previous update was at 01:52 PM ----------

export LC_ALL=C ----> The grep didn't work even after applying this.