Re: use grep or other command to get exactly pattern

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ann kok wrote:
> 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  
> 10.0.0.71
> 10.0.0.72
> 10.0.0.7

grep '^10\.0\.0\.7$' file   

The ^ means the start of the line, \. means match a "." character. If
you just used . it means to match any character. $ means the
end of the line.
-- 
Norman Gaywood, Systems Administrator
University of New England, Armidale, NSW 2351, Australia

ngaywood@xxxxxxxxxx            Phone: +61 (0)2 6773 3337
http://mcs.une.edu.au/~norm    Fax:   +61 (0)2 6773 3312

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux