0

Suppose i'm in a folder

/data/

The folder data contains 10 other folders

/data/temp1
/data/temp2
/data/temp3
and so on  

all of which have .gz files in them , i.e temp1 , temp2 , temp3 till temp10 all contain .gz files in them I want to be able to locate a certain string lets suppose ERROR: within ALL files located in all 10 directories.

Is there a command that can help me do this ?

1 Answers1

0

A basic find command should do:

# find /data -name "*.gz" -exec zgrep "ERROR" {} \;

There are a few alternate (and possibly more efficient) ways it could be formatted such as with xargs, but this will do the job, at least insofar as your question has asked.

Kefka
  • 1,536
  • 2
  • 17
  • 32