我希望到grep爲AAA和BBB和CCC從FILE1.TXT在同一線路上的任何順序FILE2.TXTAWK比較一個文件與另一個文件
FILE1.TXT
aaa bbb ccc
ddd fff ggg
hhh ddd jjj
jjj ccc
FILE2.TXT
aaa bbb ccc ddd fff ggg --> output whole line since it matches with aaa bbb ccc of file1.txt
aaa ddd jjj hhh --> no output since it does not match with any search pattern in file1.txt
ccc ddd fff ggg jjj --> output whole line since it matches with jjj ccc of file1.txt
這是我想出了這樣的腳本遠。但不輸出任何東西
gawk 'NR==FNR{a[$1,$2,2$3]++;next} ($0 in a)' file1.txt file2.txt
jjj ccc在file1.txt中的第4行,並且file2.txt中沒有line4,所以從技術上講,只有file2.txt的第一行應該在輸出中 –