ain

command module
v0.0.0-...-caf1a3d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2025 License: MIT Imports: 6 Imported by: 0

README

ain

Append lines into a file as long as the lines don't already exist

Usage

a file called list.txt contains a list of names. newlist.txt contains a second list of names, some of which appear in list.txt and some of which do not. ain is used to append the new names in newlist.txt to list.txt.

▶ cat list.txt
Mark
Jake
David

▶ cat newlist.txt
James
David
Luke
Mark

▶ cat newlist.txt | ain list.txt
James
Luke

▶ cat list.txt
Mark
Jake
David
James
Luke

Note that the new lines added to list.txt are also sent to stdout

▶ cat newlist.txt | ain list.txt -d
Luke
James

Flags

  • To view the new lines in stdout, but not append to the file, use the dry-run option -d.
  • To view the repeated lines in stdout, but not append to the file, use the wet-run option -s.
  • To view the repeated lines in stdout, and append them to the file, use the repeat option -r.
  • 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/0xAsce/ain@latest

Or download a binary release.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL