Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomnomnom/anew
A tool for adding new lines to files, skipping duplicates
https://github.com/tomnomnom/anew
Last synced: 24 days ago
JSON representation
A tool for adding new lines to files, skipping duplicates
- Host: GitHub
- URL: https://github.com/tomnomnom/anew
- Owner: tomnomnom
- License: mit
- Created: 2019-04-02T11:01:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-12T01:06:36.000Z (10 months ago)
- Last Synced: 2024-10-01T18:22:16.446Z (about 1 month ago)
- Language: Go
- Size: 9.77 KB
- Stars: 1,357
- Watchers: 22
- Forks: 150
- Open Issues: 5
-
Metadata Files:
- Readme: README.mkd
- License: LICENSE
Awesome Lists containing this project
- awesome-password-cracking - 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. (Wordlist tools / Generation/Manipulation)
- project-awesome - tomnomnom/anew - A tool for adding new lines to files, skipping duplicates (Go)
- awesome-bugbounty-tools - anew - A tool for adding new lines to files, skipping duplicates (Miscellaneous / Useful)
- WebHackersWeapons - anew
README
# 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](https://github.com/tomnomnom/anew/releases) for your platform.