Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new to linux, need grep help

Status
Not open for further replies.

786snow

Programmer
Joined
Nov 12, 2006
Messages
75
Hi,

I have directory, with folders and then those folders have further subfolders. I have a file that have a text

Exchange - changes to NASDAQ

I need to find the file that has that?


How can use grep to do that. I don't know how grep works I tried but it did not work

Thanks
 
Hi

man grep said:
-R, -r, --recursive
Read all files under each directory, recursively;
this is equivalent to the -d recurse option.
If your [tt]grep[/tt] has such option :
Code:
grep -r 'Exchange - changes to NASDAQ' .

Feherke.
 
thanks a lot, it possible to put that output to a new file?
because screen scroll a lot when the results come and I miss the top part of it,
 
Hi

Yes. Redirect it :
Code:
grep -r 'Exchange - changes to NASDAQ' . [red]> /output/file[/red]
Or just view it with a pager :
Code:
grep -r 'Exchange - changes to NASDAQ' . [red]| less[/red]

Feherke.
 
You can always issue a magical command:

man grep
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top