Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Searching within groups of files

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
logick
Posts: 18
Joined: 2009-12-23 14:31

Searching within groups of files

#1 Post by logick »

Hey guys,

is there a way within Debian to search for a phrase that lies within a set of documents?

e.g. if I wanted to find every occurence of the phrase "GetFITSWCS" in a collection of 35 text documents, without going through each one individually - like a file search, but searching within the files.

Thanks,
Ollie

smallchange
Posts: 1740
Joined: 2009-05-04 15:56
Been thanked: 1 time

Re: Searching within groups of files

#2 Post by smallchange »

Grep is the program that does this. Something like

Code: Select all

grep GetFITSWCS file1 file2
or

Code: Select all

grep GetFITSWCS *.txt
You can find out more about grep by running

Code: Select all

man grep

User avatar
keithpeter
Posts: 502
Joined: 2009-06-14 08:06
Location: 5230n 0155w

Re: Searching within groups of files

#3 Post by keithpeter »

Hello Logik and all

Grep?

Load the terminal and cd to the directory with the text files in

http://www.uccs.edu/~ahitchco/grep/

Nice looking tutorial page with examples

Smallchange hit the publish button first :-)

logick
Posts: 18
Joined: 2009-12-23 14:31

Re: Searching within groups of files

#4 Post by logick »

Thanks guys, that was perfect. Cheers!

smallchange
Posts: 1740
Joined: 2009-05-04 15:56
Been thanked: 1 time

Re: Searching within groups of files

#5 Post by smallchange »

That is a nice little tutorial. Covers the basics of a large topic.

Post Reply