0

How do I grep recursively?

I've looked at the above and for me at least it won't recurse if I start from a root directory. This is a on a Windows 7.1 using CMD.EXE

On a network share I'm trying to extract all lines with the word PAY from series of files called TRADING.EOD in a series of folders DATA151101, DATA151102, DATA151103, etc which are created in the root folder which has been mapped to S:

grep -r --include="TRADING.EOD" "PAY" . 

gives me

grep: .: Invalid argument

alternatively from my local hard drive I get

grep: unable to record current working directory: Bad file descriptor (local hard drive

Ideas on how I might get this work.

Community
  • 1
  • 1

1 Answers1

0

I think you need the command:

findstr /S "PAY" TRADING.EOD

it will search in your current directory (+subfolders)

Output will be:

DATA151101\TRADING.EOD:PAY <Text after "PAY" in file>
DATA151102\TRADING.EOD:PAY <Text after "PAY" in file>

EDIT: if you want to search in mapped Drive "S:" use command:

cd /d S:

first.