Regex probs ...

Mike Bird mgb-ubuntu at yosemite.net
Sat Jun 7 22:53:45 BST 2008


On Sat June 7 2008 14:38:03 dave selby wrote:
> My regex is hopeless ... I am trying to match
>
> '0:00 motion'
>
> and it just is not having it ...
>
> echo '7882 pts/1    Sl+    0:00 motion' | grep -e
> '[:digit;]:[:digit:][:digit:].motion$'
>
> can anyone tell me where I am going wrong ?

1) There's a typo where the second colon should be.
2) Brackets are single but should be double.

I think you're looking for:

'[[:digit:]]:[[:digit:]][[:digit:]].motion$'

--Mike Bird




More information about the ubuntu-users mailing list