Logic behind word-boundary difference between BSD grep and GNU grep -


can please explain/help me understand logic behind difference between bsd grep , gnu grep? i've added carets below matches.

$ grep --version grep (bsd grep) 2.5.1-freebsd $ cat t1  admin:*:80:root $ grep '\<.' t1 admin:*:80:root ^^^^^   ^^ ^^^^ 

versus

$ grep --version gnu grep 2.6.3  copyright (c) 2009 free software foundation, inc. license gplv3+: gnu gpl version 3 or later <http://gnu.org/licenses/gpl.html> free software: free change , redistribute it. there no warranty, extent permitted law.  $ cat t1  admin:*:80:root $ grep '\<.' t1 admin:*:80:root ^       ^  ^    

it seems gnu grep getting right , bsd grep isn't. thought \< supposed word boundary? note grep '\<ad' t1 seems same result in both versions, e.g.:

$ cat t2 admin:*:80:root sadmin:*:81:root $ grep '\<ad' t2 admin:*:80:root ^^ 

what gives?

thanks in advance.

richard

using \> specify word boundary wouldn't work bsd grep. try [[:<:]] instead.

this post gives pretty useful information on word boundaries various utilities.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -