
Uno strumento per aggiungere nuove righe ai file, saltando i duplicati.
Aggiunge righe da stdin a un file, ma solo se non sono già presenti nel file.
Invia anche le nuove righe a stdout, rendendolo un po' come un tee -a che rimuove i duplicati.
Qui, un file chiamato things.txt contiene un elenco di numeri. newthings.txt contiene un secondo
elenco di numeri, alcuni dei quali compaiono in things.txt e altri no. anew viene usato
per aggiungere questi ultimi a 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
Nota che le nuove righe aggiunte a things.txt vengono inviate anche a stdout, questo consente di
reindirizzarle verso un altro file:
▶ cat newthings.txt | anew things.txt > added-lines.txt
▶ cat added-lines.txt
Three
Four
-d.-q.Puoi installarlo usando go:
go install -v github.com/tomnomnom/anew@latest
Oppure scarica una release binaria per la tua piattaforma.