Is there a tool which will give me the character (i.e. byte) offset for
a matched pattern?

grep can tell me the line number on which it finds a match with the -n
option:

  echo -e 'a\nb\nc\nd\ne\nf' | grep -n e

What I'd like to know is the character offset.  Unfortunately, the
following doesn't work:

  echo 'abcdefghijklmnopqrstuvwxyz' | grep -b --color efg

Instead of printing 5 (or 4), grep returns 0.  It seems as though -b
means how many characters up to the newline preceding the match.  A 'man
grep' didn't shed any light.

Regards,
- Robert


 
_______________________________________________
CWE-LUG mailing list
[email protected]
http://www.cwelug.org/
http://www.cwelug.org/archives/
http://www.cwelug.org/mailinglist/

Reply via email to