Link to home
Start Free TrialLog in
Avatar of bt707
bt707Flag for United States of America

asked on

Search for string Grep

Problem with searching for a string.

EX:

when i do a search such as     grep keyword1.keyword2.keyword3  filetosearch
I want to get only lines that match that exact string but i get all lines that match that and any part of the string.

I've also tried  grep 'keyword1.keyword2.keyword3'  filetosearch  and grep "keyword1.keyword2.keyword3"  filetosearch
but same results each way.

How can i tell grep to ONLY give me the exact quote and nothing else.

Thanks,
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bt707

ASKER

Hello Sunnycoder

forgot to put in, i did try to escape the . but still get same thing, not sure what version of grep, it is a new server with fresh intall of solaris 8

Thanks,
grep "^keyword1.keyword2.keyword3$"  
Avatar of bt707

ASKER

Hello again Sunnycoder,

It is working now, guess i was in a hurry when i did the escape, put in the wrong slash, got it now.

Thanks,