Solved

Search for string  Grep

Posted on 2004-08-18
4
360 Views
Last Modified: 2010-08-05
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,
0
Comment
Question by:bt707
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 500 total points
ID: 11829213
Hi bt707,

what grep are you using? I am using gnu grep 2.5.1 and it works fine even without the quotes ...
Try escaping the . with \

Sunnycoder
0
 

Author Comment

by:bt707
ID: 11829354
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,
0
 
LVL 20

Expert Comment

by:tfewster
ID: 11829360
grep "^keyword1.keyword2.keyword3$"  
0
 

Author Comment

by:bt707
ID: 11829400
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,
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
IBM flash storage 840 15 58
Install MySQL 5.6 and PHP on Centos Linux 6 99
Solaris 4.1.3 cloning and booting 13 71
SCP a file to multiple machines using a script 4 16
Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now