Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

grep for string in all files in directories with certain names

I have csv files in directories with this structure:

20090120/
20090121/
20090122/
etc...

I want to grep for a certain string in all of the csv files in these directories, but only for January 2009, e.g. 200901*/*.csv

Is there a bash command line argument that can do this?

like image 784
user788171 Avatar asked Jan 02 '13 02:01

user788171


People also ask

How do I grep text in all files in a directory?

To include all subdirectories in a search, add the -r operator to the grep command. This command prints the matches for all files in the current directory, subdirectories, and the exact path with the filename. In the example below, we also added the -w operator to show whole words, but the output form is the same.

How do you find a string in all files in a directory in Unix?

You can use grep command or find command as follows to search all files for a string or words recursively.


1 Answers

Yes. grep "a certain string" 200901*/*.csv.

like image 187
Phil Frost Avatar answered Nov 25 '22 17:11

Phil Frost