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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to search directory & subdir for certain strings

Status
Not open for further replies.

sabo1

Technical User
Jul 17, 2007
1
US
I am using a data recovery tool. It restores directories and subdirectories with numbered file names so I need to be able to search for certain strings in the contents of the file. I would also like to be able to search for file suffixes like .mp3 or .doc if possible.

So this is what I have

awk '/the/ {print}' recup_dir.1/*.txt

but I get an error that says too many directories. So I was wondering if some kind of loop like

for $i in


can anyone show me exactly what should work. I am not a programmer. I know just enough to be dangerous and to cause many headaches.

Thanks
 
Like this ?
for f in recup_dir.1/*.txt; do awk '/the/' "$f"; done

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top