Search for a string
Hi,
I would like to search for a particular string in a directory which contains n no of files. I don't know in which file the string is present, so the script should search for all the files that contains this string and return back the complete path of the filename. Guys ...i require this very badly Manjesh |
If you're using kde, I know that konqueror will do this quite easily. Just go into the folder where you want to search and use Tools->Find File... then use asterisk * to indicate all files and go into the Content tab and enter your string. Konqueror will find all files containing that string.
If this is homework then that solution would not be what's required but we're not here to do your homework for you, are we? ;) jdk |
Shell Script
I require this in a shell script or command line arguments. I don't access to the GUI.
|
Go in to the top level directory and run the following command
Code:
grep -r 'search_string' * Code:
grep -rl 'search_string' * |
Quote:
|
All times are GMT -5. The time now is 12:52 PM. |