


You can indicate each pattern with a separate e option character, or with newlines within pattern. Here is my final command line: find / syntax because I want the output lines with the fullpath including the leading slash, and in this way you can use the command without cd / i.e. Specifies one or more patterns separated by newlines for which grep is to search.

Update: I found a working solution with find and xargs which seems to be working and uses less system resources than the find -exec solution. Why it doesn't end? Is there any better way to do this (it's a one time job, I don't need to execute this more than once) grep searches the named input FILEs (or standard input if no files are named, or if a single hyphen-minus (-) is given as file name) for lines containing a. The grep tool searches the named input files for lines containing a match to the given pattern. Root 24909 0.0 0.1 3772 1520 pts/1 S+ Feb10 0:15 grep -nr needle / -exclude-dir=.svn To locate a string within a file, use the grep tool. I run this script about 8 hours ago and even on a small filesystem (less than 5GB) it doesn't end and if I run top or ps the process seems sleeping Problems: With many files, the command can become too long and grow. The option i ensure that the search is case-insensitive.
Go through a list of files, search for the text foo: grep -i foo- .
However when I run the command on the root directory the grep process hang after a while. Assemble a list of all JavaScript files in the current directory: find.
#FIND ANY FILE GREP FULL#
Where /path1 is the full path of the file, nn is the row containing the needle and last field is the content of the line.
If I run this command on a small directory it gives me the output I need in the form /path1/:nn:line containing needle To use grep to search for words in a file, type grep, the word or words you want to search for, the files you want to look in, and press`grep -nr 'needle' / -exclude-dir=.svn | mail -s 'References on xxx'
#FIND ANY FILE GREP UPDATE#
I need to find all the instances of a given string in the whole filesystem, because I don't remember in which configuration files, script or any other programs I put it and I need to update that string with a new one.
