I w开发者_Go百科ant to use grep to find the lines contain String in all java files under current directory.
I tried:
grep -r "String" **/*.java
But it doesn't work:
grep : **/*.java: no such file or directory
How to write it?
UPDATE
I'm on windows, using the grep provided by unxUtils, which doesn't support --include parameter. Is there any other way?
Use recursive grep:
grep -r "String" --include=*.java .
I guess the unxUtils provide the find utility. So you could try to do:
find . -name "*.java" -exec grep "String" {} \;
or
find . -name "*.java" -exec grep "String" {} \+
The first version will execute one grep command for each file found. The latter version will only execute as many grep commands as necessary but not every find version supports the + argument.
加载中,请稍侯......
精彩评论