LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-10-2003, 03:29 AM   #1
llimllib
LQ Newbie
 
Registered: Aug 2002
Location: Philadelphia, US
Distribution: RH 9
Posts: 28

Rep: Reputation: 15
multiple file search


quick question:

given a directory "/home/blah" containing 7 files, what's the best way to search for the string "example string" in any the files?

I searched for the answer, and could only find how to use sed to replace "example string" with "other string". What's the best way to search for text inside a file? what options are there?

Thanks.
 
Old 02-10-2003, 03:40 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well grep of course

grep string /path/to/somewhere/*
 
Old 02-10-2003, 04:25 AM   #3
llimllib
LQ Newbie
 
Registered: Aug 2002
Location: Philadelphia, US
Distribution: RH 9
Posts: 28

Original Poster
Rep: Reputation: 15
thanks...

I needed the asterisk. I had tried cd'ing to the dir, then doing grep "mystring", when of course I needed to use grep "mystring" * because otherwise it tries to read from stdin. Thanks.
 
  


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
how do I search for multiple filetypes? fisayo Linux - General 4 07-19-2005 08:05 AM
search and copy multiple files NiallC Programming 2 04-29-2005 05:40 AM
Looking for a multiple file search and replace tool, prefer graphical haimeltjnfg Linux - Software 6 02-02-2005 11:53 PM
multiple search on mysql gmarais Programming 3 03-10-2004 09:59 AM
trying to search and replace text file for single & multiple line breaks separately brokenfeet Programming 7 08-29-2003 02:56 PM


All times are GMT -5. The time now is 05:42 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