LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-23-2008, 04:00 AM   #1
mksc
LQ Newbie
 
Registered: May 2008
Posts: 10

Rep: Reputation: 0
Exclamation how to find out particular string in a file


Hi all

how to find out particular string in a text file?

I have a file which contains file path.
ie
/root/Documents/abs.txt
/root/Documents/abs11.txt
/root/Documents/abs.txtt
/root/abs.txt
/root/Documents/abs.tx
/root/Documents/abs.txt1

I want to use "grep" command for find out string "/root/Documents/abs.txt"
but it result is this:

/root/Documents/abs.txt
/root/Documents/abs.txtt
/root/Documents/abs.txt1


But i need only: /root/Documents/abs.txt

what is solution of this?

Thanks
MKSC
 
Old 06-23-2008, 04:04 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Using the -x or the -w option seems to work, i.e.

grep -x "/root/Documents/abs.txt" file, or
grep -w "/root/Documents/abs.txt" file.

Last edited by Nylex; 06-23-2008 at 04:09 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
giving search-string(s) from a file to linux "find" command Fond_of_Opensource Linux - Newbie 3 02-02-2009 07:14 PM
find a string in all ascii file of a SOLARIS system markraem Solaris / OpenSolaris 4 01-16-2008 06:58 PM
Shell script: how to find a file containing a string guarriman General 2 08-27-2007 04:39 AM
Python: find defined text string in a file, and replace the whole line Dark Carnival Programming 6 05-22-2007 07:02 AM
Shell script: Find "\n\t..." to replace a string in a file michael24h7d Programming 8 05-11-2007 04:07 AM


All times are GMT -5. The time now is 08:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration