
標準入力から受け取った行を、ファイル内にまだ存在しない場合にのみファイルへ追記します。
新しい行は stdout にも出力されるため、重複を除去する tee -a のような動作になります。
ここでは、things.txt というファイルに数字のリストが含まれています。newthings.txt には2番目の数字のリストが含まれており、
その一部は things.txt に存在し、一部は存在しません。anew は
後者を things.txt に追記するために使われます。
▶ cat things.txt
Zero
One
Two
▶ cat newthings.txt
One
Two
Three
Four
▶ cat newthings.txt | anew things.txt
Three
Four
▶ cat things.txt
Zero
One
Two
Three
Four
things.txt に追加された新しい行は stdout にも送信されるため、それらを
別のファイルにリダイレクトできます。
▶ cat newthings.txt | anew things.txt > added-lines.txt
▶ cat added-lines.txt
Three
Four
-d を使用します。-q を使用します。go を使ってインストールするか:
go install -v github.com/tomnomnom/anew@latest
または、お使いのプラットフォーム向けのバイナリリリースをダウンロードすることもできます。