Menu

grep recursive doesn't seem to work

Help
2006-04-11
2012-07-26
  • Nobody/Anonymous

    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?

    • Todd Greene
     
    • Mathias Michaelis

      > 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

       
    • GnuWin

      GnuWin - 2006-04-11

      The last argument must be a list of filenames. So,

      grep -ir --include="*.txt" database *

      should work.

       
MongoDB Logo MongoDB