Solved

Search for string  Grep

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
OpenLDAP Proxy to Active Directy 6 364
Searching File Names and Eliminating Duplicates in Linux 4 75
Linux "time" command output redirection 16 179
Access_log 17 148
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…

856 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