regex help needed

Bennett Todd bet at
Fri Oct 15 07:12:56 PDT 2004

2004-10-15T02:36:33 John Galbrit:
>  --- Bennett Todd <bet at> wrote: 
> > 
> > grep '[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*' filename
> Thanks! Though for anyone else interested, grep with the -o switch is
> needed if you just want to extract the IP's only.

Wow --- I'd never heard of that one, when I wanted to extract just
the matching pattern I turned to other tools, e.g.

sed -n '/^.*\([1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\.[1-9][0-9]*\).*$/s//\1/p'

-o is nice to know about.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <>

More information about the lfs-chat mailing list