Im using Ubuntu Karmic as my operating system . I frequently need to search my project folder for a particular string, to see if its there in any of the files in the project folder or its subfolders.
I currently use the find command to do that, and have written a script that accepts the string im looking for as the parameter.
find . -exec grep -l $1 {} \;
But the problem with this is that it does not work with strings having a space in them. So, is there any way to search for space separated strings as well, or is there any available tool that does the job ?
Thank You.
How are you invoking your script?
If you want to search for space separated strings you need to do the
invocation in the form:
%./script_name.sh 'search string'
and also change the find invocation to :
find . -exec grep -l “$1” {} \;