On 11/28/06, Robert Citek <[EMAIL PROTECTED]> wrote:

> What I'd like to know is the character offset.  Unfortunately, the
> following doesn't work:
>
>   echo 'abcdefghijklmnopqrstuvwxyz' | grep -b --color efg

Hello Robert:

 This works:
[EMAIL PROTECTED]:~$ echo -e "a\nb\nc\nd\ne\nf" |  grep -b e
8:e

The man page indicates that it only works on lines of output
-b, --byte-offset
              Print the byte offset within the input file before each line  of
              output.

So
[EMAIL PROTECTED]:~$ echo 'abcdefghijklmnopqrstuvwxyz' | grep -b --color efg
0:abcdefghijklmnopqrstuvwxyz

is correct; the byte offset of one line is zero.

Notice it includes the new lines also. See this bug report for further details:
bug #12660: byte-offset has an off-by-one error
http://savannah.gnu.org/bugs/?func=detailitem&item_id=12660

-- 
Kind regards,
Jonathan

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

Reply via email to