在多语料库中快速获取多个关键词的方法

时间:2013-01-24 03:46:13

标签: linux unix grep

我有13K术语的列表,我想确定它在24K文本文件中的存在。 所以最后我想要terms->file names上下文。

使用Unix / bash命令实现此目的的最佳方法是什么?

我可以像这样使用Perl脚本,但速度太慢了:

#!/usr/bin/perl 
#....skip...
foreach my $term (@terms) {
    system("grep $term /corpus/*.txt/")
}

1 个答案:

答案 0 :(得分:2)

grep --fixed-strings --word-regexp --with-filename --file=terms.txt --recursive /corpus