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.
これらの2つのファイルを考えると
file1.txt ------ foo bar file2.txt ------ foo 1 foo 2 bar 31
file2.txtで成功した結合の最初の行を取得するにはどうすればよいですか?参加後の期待される結果は次のとおりです。
foo 1 bar 31
私はこれを試しましたが、機能しませんでした:
join file1.txt file2.txt
正しい結合コマンドは何ですか?
試した結合により、foofromの両方のインスタンスが出力されfile2ます。1つだけを選択するsort場合は、実際の結合を行う前に、両方のファイルに一意のエントリがあることを確認するために使用できます。
foo
file2
sort
join <(sort file1) <(sort -k1,1 -u file2)