use grep or other command to get exactly pattern

Mark C. Allman mcallman at allmanpc.com
Fri Jan 18 21:12:09 UTC 2008


On Fri, 2008-01-18 at 20:35 +0000, Steve Searle wrote:
> Around 08:20pm on Friday, January 18, 2008 (UK time), ann kok scrawled:
> 
> > how can use grep or use other command to get exactly
> > pattern eg: 10.0.0.7 only?
> > 
> > eg: grep 10.0.0.7 file. I want to get 10.0.0.7 only
> > not  
> 
> grep 10.0.0.7$ file
> 
> Assuming that there is nothing else on the line after the IP address.
> 
> Steve
> 
> -- 
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

To be nice and general:  
     grep '10\.0\.0\.7[^0-9]' file 
or   grep '10\.0\.0\.7[^:digit:]' file

-- Mark C. Allman, PMP
-- Allman Professional Consulting, Inc.
-- www.allmanpc.com, 617-947-4263

BusinessMsg -- the secure, managed, J2EE/AJAX Enterprise IM/IC solution







More information about the fedora-list mailing list