Find and grep combination in CygWin under Windows or recursive file grep

By neokrates, written on November 10, 2010

bash   snippet

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 571 views
Rate it
Ad
Poll
  • What tools do you use for site design?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext

Combining find and grep under Linux is trivial, there are many ways, they all work. Most piped versions didn’t work for me under Windows. So that seems to be the problem of selecting the one command, which does work. Many, which are supposed to work, do fail under cygwin (that can be also dependent on CygWin version you have)

But the two calls presented here did work:

1. Find recursively all makefiles and grep them for “(CP”, then write the output into found_in_make.txt file.

find . -name 'makefile'  -exec grep "(CP" {} \; > found_in_make.txt

 
2. Recursively grep excluding all “.svn” directories and searching through .mk files

grep.exe --exclude-dir="\.svn" -r '$(CP' . *.mk
Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
RELATED
Pages
Posts
SOCIAL
Be Sociable, Share!

Leave a Reply