Solved

Search for string  Grep

Posted on 2004-08-18
4
357 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
create user in TSM 7 552
Unix / Linux grid computing 5 126
how to check for shares on HP-UX 1 50
UNiX Script filesystem space usage 19 60
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 …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

707 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

12 Experts available now in Live!

Get 1:1 Help Now