help - busybox- grep and Source command

Juergen Hennerich juergen at hennerich.eu
Mon Sep 4 16:14:10 UTC 2006


Rich Felker schrieb:
> On Mon, Sep 04, 2006 at 01:13:33PM +0200, Juergen Hennerich wrote:
>> Juergen Hennerich schrieb:
>>
>>> grep -w word <-> grep -E '(^|[^:alnum:_])word([^:alnum:_]|$)'
>>>
>> I totally forgot: While this is not POSIX (I think), the anchors '\>' 
>> '\<' are most likely also supported.
> 
> These are not POSIX and intentionally omitted from my implementation.
 From what implementation?

Since grep uses the libc regex support it should support "\>" and "\<" 
on all platforms, on which the libc has support for it. This is glibc 
(of course) and uClibc (I've tested it). Of course if you write your own 
libc, then you are free to not support those. And yes, they are 
definitely not in POSIX, I think they are from vi.

> Also using ^ or $ the way you used them is possibly not POSIX; I
> forget the details. :(
I don't see why it shouldn't be POSIX conform.

"`^'  (match­ ing  the  null  string  at  the beginning of a line), `$'
(matching the null string at the end of a  line)...."

"A  bracket  expression is a list of characters enclosed in
`[]'.  It normally matches any single character from  the
list  (but  see below).   If the list begins with `^', it
matches any single character (but see below) not from  the
rest of the list."

Juergen

> 
> Rich
> 




More information about the busybox mailing list