LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-20-2004, 12:00 PM   #1
nextekcarl
Member
 
Registered: Oct 2003
Location: Portland
Distribution: Gentoo
Posts: 73

Rep: Reputation: 15
Search all text files?


here, I need a way to search every text file on my hard drive for a certain phrase, but I have no idea where to start. I know it could take a very long time, but that's OK. I just need a list of the file (or maybe files) that contains the phrase I am looking for. Thanks.
 
Old 10-20-2004, 12:34 PM   #2
apolinsky
Member
 
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 14.1, 14.2; Debian Jessie; Debian Stretch
Posts: 293

Rep: Reputation: 36
Russell Sage wrote a book entitled 'Tricks of the Unix Masters' published by Sams. He created a script he deemed tgrep. grep, I'm sure you know, will search for patterns within files. Usining tgrep you would specify the pattern, and the place you want to start your search. I hesitate to list the code because of possible copyright issues, but might suggest a simple search would lead the code.
 
Old 10-20-2004, 12:37 PM   #3
toubo
LQ Newbie
 
Registered: Aug 2004
Posts: 10

Rep: Reputation: 0
Try this:

find / -name "*.txt" -exec grep ABC {} \;

This script will search all file ending with txt from root and look for ABC string.

Toubo
 
Old 10-20-2004, 12:46 PM   #4
nextekcarl
Member
 
Registered: Oct 2003
Location: Portland
Distribution: Gentoo
Posts: 73

Original Poster
Rep: Reputation: 15
Will this find the string in config type files, too?
 
Old 10-20-2004, 01:18 PM   #5
apolinsky
Member
 
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 14.1, 14.2; Debian Jessie; Debian Stretch
Posts: 293

Rep: Reputation: 36
grep searches all files
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert DOS text files to UNIX text files ta0kira Linux - Software 7 03-15-2011 12:42 PM
Search text in files remotely anjanesh Red Hat 2 08-15-2005 10:03 AM
How to search and replace a text using grep DediPlace Linux - General 2 05-29-2005 07:47 PM
Need to search for *last* occurrance in a text file ericcarlson Linux - Software 1 09-11-2004 03:08 PM
what tool can search for documents containing certain text? jacksonscottsly Linux - Software 3 07-19-2004 02:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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