Regex probs ...
Chris Mohler
cr33dog at gmail.com
Sat Jun 7 21:51:43 UTC 2008
On Sat, Jun 7, 2008 at 4:38 PM, dave selby <dave6502 at googlemail.com> wrote:
> Hi All,
>
> 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 ?
No expert, but how about this:
echo '7882 pts/1 Sl+ 0:00 motion' | grep -o "[0-9]:[0-9][0-9].motion$"
-o tells grep to only output the matched portion...
Chris
More information about the ubuntu-users
mailing list