unix - Grep examples - can't understand -
given following commands:
ls | grep ^b[^b]*b[^b] ls | grep ^b[^b]*b[^b]*
i know ^ marks start of line, can give me brief explanation these commands? do? (step step)
thanks!
^
can mean 2 things:
- mark beginning of line
- or negates character set (whithin
[]
)
so, means:
- lines starting 'b'
- matching (0+) characters other 'b'
- matching 'b'
- followed not-'b' (or nothing @ all)
it match
bb bzzzzzb bzzzzzbzzzzzzz
but not
zzzzbb bzzzzzxzzzzzz
Comments
Post a Comment