Anew
A tool for adding new lines to files, skipping duplicates
Install / Use
/learn @tomnomnom/AnewREADME
anew
Append lines from stdin to a file, but only if they don't already appear in the file.
Outputs new lines to stdout too, making it a bit like a tee -a that removes duplicates.
Usage Example
Here, a file called things.txt contains a list of numbers. newthings.txt contains a second
list of numbers, some of which appear in things.txt and some of which do not. anew is used
to append the latter to 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
Note that the new lines added to things.txt are also sent to stdout, this allows for them to
be redirected to another file:
▶ cat newthings.txt | anew things.txt > added-lines.txt
▶ cat added-lines.txt
Three
Four
Flags
- To view the output in stdout, but not append to the file, use the dry-run option
-d. - To append to the file, but not print anything to stdout, use quiet mode
-q.
Install
You can either install using go:
go install -v github.com/tomnomnom/anew@latest
Or download a binary release for your platform.
Related Skills
node-connect
340.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
340.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.1kCommit, push, and open a PR
