我有13K术语的列表,我想确定它在24K文本文件中的存在。
所以最后我想要terms->file names
上下文。
使用Unix / bash命令实现此目的的最佳方法是什么?
我可以像这样使用Perl脚本,但速度太慢了:
#!/usr/bin/perl
#....skip...
foreach my $term (@terms) {
system("grep $term /corpus/*.txt/")
}
答案 0 :(得分:2)
grep --fixed-strings --word-regexp --with-filename --file=terms.txt --recursive /corpus