【发布时间】:2017-07-25 22:36:05
【问题描述】:
我参考了以下链接来比较两个文件: Compare files with awk
awk 'NR==FNR{a[$1];next}$1 in a{print $2}' file1 file2
如果在 file1 中找到 file2 的第 1 列,则打印 file2 的第 2 列。
但我的要求略有不同。如果在关联数组中找到 file2 的第一列(使用 file1 的第一列构建),如何打印 file1 的第二列?
【问题讨论】:
标签: awk compare comparison