说我有subversion目录的url。我主要是在windows上使用tortoiseSVN浏览它。
如何搜索该目录(及其子文件夹)中的文件内容以获取3个单独的单词(每个单词都是不同的搜索):
即
foo
bar
blah
然后获取哪些文件包含该单词的结果。 即
foo (23 hits)
my.xml
the.txt
bar (9 hits)
other.txt
blah (178 hits)
new.xml
fake.txt
old.xml
other.xml
答案 0 :(得分:3)
我不知道你想要的本地解决方案。
我自己制作一个简单的批处理文件。它不会完全给你你所要求的,但非常接近。
或者搜索'baregrep'并查看是否适合你(我还没有使用过它)。
这就是我要做的事情:
1)安装cygwin
这给你一个体面的grep(如果你愿意,你可以忽略其他一些东西)。 grep是一个非常好的工具,用于在文本文件(如代码)中查找内容。 Windows XP找不到它。 http://cygwin.com/index.html
2)找出你需要的grep命令
这是:
grep -r -i --include "*" --exclude-dir ".svn" "foo" .
细分:
-r == recursive
-i == ignore case (remove this if you want case sensitive)
--include "*" == include all files
--exclude-dir ".svn" == tells grep to ignore everything in the hidden subversion folders
"foo" == what we're looking for
. == start from the current directory
所以这个命令说'查看这个文件夹下的所有文件,但不能查找.svn文件夹中的“foo”'
将其粘贴在路径中某处的批处理文件(例如,名为findsource.bat
)中。
为此,您需要将“foo”替换为“%1”
grep -r -i --include "*" --exclude-dir ".svn" "%1" .
就个人而言,我会把它留在那里。
然后,您可以从命令行使用批处理文件 CD到源树的根目录。
findsource foo
如果你想要点击次数,你可以把它传递给cygwin附带的另一个工具 - wc
findsource foo | wc -l