LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   searching text within a folder in linux (https://www.linuxquestions.org/questions/linux-newbie-8/searching-text-within-a-folder-in-linux-590159/)

muby 10-07-2007 10:45 PM

searching text within a folder in linux
 
i just wonder if this is possible (searching text within a folder in linux), i doing programming i need to know in which file certain funtions are, any one?

thank you
Muby

bigrigdriver 10-07-2007 10:52 PM

find /path/to/folder -type f | grep 'text string'

This should recursively search through the files in folder for the given text string.

speck 10-08-2007 12:13 AM

If you just need to search only a single directory (and no subdirectories):
Code:

grep "string to search" *
If you need to search multiple directories and/or subdirectories:
Code:

find /dir/to/search_1 /dir/to/search_2 -type f -print | xargs  grep "string to search"

chrism01 10-08-2007 01:13 AM

or use grep -r

muby 10-08-2007 07:45 AM

bigrigdriver, speck & chrism01 thank you very much


All times are GMT -5. The time now is 05:40 AM.