I'm using grep 2.5.1 on a Windows XP system. I'm trying to use grep to find all text files in a directory tree that contain a certain string. I have tried all of the following, and none of them work:
> grep -ir --include=".txt" database .
> grep -r --include=".txt" -i database .
>
Both commands works for me with grep version 2.5.1 on a Windows XP system.
> grep -ir --include=".txt" database /
> grep -r --include=".txt" -i database /
>
This doesn't find anything on my machine -- nor does it eject any error messages.
Strange! Are you running your commands within a CMD window? Are you within a directory you have the rights to access to?
With kind regards
Mathias
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using grep 2.5.1 on a Windows XP system. I'm trying to use grep to find all text files in a directory tree that contain a certain string. I have tried all of the following, and none of them work:
grep -ir --include=".txt" database
grep -r --include=".txt" -i database[returns "grep: (standard input): Not enough space"]
grep -ir --include=".txt" database .
grep -r --include=".txt" -i database .
[returns "grep: .: Invalid argument"]
grep -ir --include=".txt" database /
grep -r --include=".txt" -i database /
[returns "grep: /: Invalid argument"]
This seems like a straightfoward use of grep. Am I doing something wrong? Or is this grep just not working correctly?
> grep -ir --include=".txt" database .
> grep -r --include=".txt" -i database .
>
Both commands works for me with grep version 2.5.1 on a Windows XP system.
> grep -ir --include=".txt" database /
> grep -r --include=".txt" -i database /
>
This doesn't find anything on my machine -- nor does it eject any error messages.
Strange! Are you running your commands within a CMD window? Are you within a directory you have the rights to access to?
With kind regards
Mathias
The last argument must be a list of filenames. So,
grep -ir --include="*.txt" database *
should work.