【发布时间】:2016-03-01 21:47:19
【问题描述】:
我想做类似的事情
if ($2 in another file) { print $0 }
假设我有文件 A.txt,其中包含
aa
bb
cc
我有 B.txt 之类的
00,aa
11,bb
00,dd
我要打印
00,aa
11,bb
如何在 awk 中进行测试?我不熟悉一次处理两个文件的技巧。
【问题讨论】:
-
grep -Ff patternFile searchFile或fgrep -fpatternFile searchFile会这样做。祝你好运。