LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   grep [exact phrase] (https://www.linuxquestions.org/questions/linux-general-1/grep-%5Bexact-phrase%5D-143964/)

chrisfirestar 02-09-2004 03:45 AM

grep [exact phrase]
 
I want grep to not be so general

eg more file.txt | grep 192.168.1.1
will find

192.168.1.1
192.168.1.12
192.168.1.121

etc... any way to make it ONLY do .1 and leave off the rest?

Chris

nielchiano 02-09-2004 04:16 AM

tell it to search for "192.168.1.1{END OF LINE}"

grep "192.168.1.1$" file.txt

chrisfirestar 02-09-2004 04:30 AM

i got it to work using grep -w "192.168.1.1"

thanks anyways though


All times are GMT -5. The time now is 11:56 PM.