我想下面的命令: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