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

Re: use grep or other command to get exactly pattern





On Jan 18, 2008 12:20 PM, ann kok <annkok2001 yahoo com> wrote:
Hi all

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

thank you


     ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs

--
fedora-list mailing list
fedora-list redhat com
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

If there is something else in the line in addition to 10.0.0.7
example: 10.0.0.7 word1 word2 number1...
then use
   > grep -w 10.0.0.7 myfile | awk '{print $1}'

 if 10.0.0.7 is the second field then use '{print $2}' and so on.
~af


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