Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
joinコマンドは、2つの共通文字列を2つのファイルに出力します。しかし、一致しなかった文字列を印刷する方法はありますか?
ファイル1
a 1 b 2 c 3
file2
a 3 b 3
出力
c 3
結合コマンドの使用:
join -a1 -v1 file1 file2
-a1= 最初のファイルの一致しない行を出力します。-v正常な出力を抑える
-a1
-v
最初のフィールドに参加するには、次の 1 つの方法を使用しawkます。
awk
awk 'FNR==NR { a[$1]; next } !($1 in a)' file2 file1
結果: