我想下面的命令:AWK在while循环中不能正常工作
while read file
do
awk -v ID="$file" '$1==ID{print $0}' input2 > output
done < input1
输入1看起来是这样的:
1
2
3
4
输入2看起来是这样的:
2 a b c
3 a b c
5 a b c
6 a b c
输出应看起来像这样:
3 a b c
所以,换句话说,如果文件input2的第一列与来自文件input1的值中的一个相匹配,我希望从input2的整行打印输出。我从上面的while循环只产生空文件然而......可能是什么问题?非常感谢! >>
啊当然,谢谢! – Abdel