Linux: How to find string in a file within subdirectories

What command do I use to find a string within a file that is possibly contained within a subdirectory

The string I want to find is 8585

Thanks
Anthony LuciaAsked:
Who is Participating?
 
woolmilkporcCommented:
To search the current directory and all directories below it for files containing "8585":

grep -R "8585" .

Note the dot "." as the last parameter! It means: "start at the current directory".
"-R" means: recursive search.

If the directory where you want to start your search is not your current directory either "cd" to it first:

cd /path/to/start_dir

or replace the dot with the name of this directory:

grep -R "8585" /path/to/start_dir
0
 
Haris DulicCommented:
grep is your friend...

grep - r "8585"

more on grep
0
 
madunixCommented:
find ./ -type f -exec sed -i -e 's/old/new/g' {} \;
it goes  through sub directories.
0
 
woolmilkporcCommented:
@madunix: Anthony Lucia asked for a way to find the string, not to find and replace it with some other string.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.