My [tt]grep[/tt] (Solaris 8) doesn't seem to have the [tt]-r[/tt] switch, so I have no idea what that means.
The [tt]-l[/tt] switch means to only output the names of the files that have a match. But it should go before the word [tt]test[/tt]. The word [tt]test[/tt] is what to look for. The [tt]*[/tt] is which files to look for [tt]test[/tt] in. So the first [tt]grep[/tt] should look like...
[tt]
grep -l test *
[/tt]
...and is only listing the names of the files that contain the word [tt]test[/tt].
The vertical bar is a pipe character. The output of the first [tt]grep[/tt] is sent to the second [tt]grep[/tt]. The second grep will exclude the file names that have "convert" in them.
On Solaris, the command should look like...
[tt]
files=`grep -l test * | grep -v convert`
[/tt]
This will make the variable "[tt]files[/tt]" contain a list of files that contain the word [tt]test[/tt], but don't have the word [tt]convert[/tt] in their name.
GNU grep has tbe -r option, which allows you to recursively search a directory tree. This removes the need to use find with grep to span the directory tree.
SamBones' interpretation is correct with the addition of:search all files in this directory and below for...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.