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

By neokrates, written on November 10, 2010

bash   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • Your favorite Java IDE is?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:
Stats
    Since publication, this page was visited 667 time(s).

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
 
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
    nope :(
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply