https://github.com/sixarm/union
The `union` command for Unix text processing
https://github.com/sixarm/union
awk command shell unix
Last synced: about 2 months ago
JSON representation
The `union` command for Unix text processing
- Host: GitHub
- URL: https://github.com/sixarm/union
- Owner: SixArm
- Created: 2017-01-31T07:15:23.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2025-04-14T09:23:38.000Z (about 1 year ago)
- Last Synced: 2026-04-08T23:39:40.691Z (3 months ago)
- Topics: awk, command, shell, unix
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# The `union` command for Unix text processing
Print the lines that are in any of the inputs.
Syntax:
union ...
Example:
$ union 1.txt 2.txt
=> lines that are in either of the files.
## Notes
The order doesn't matter.
In set theory, this command is (A union B).
This command is currently implemented using `awk` and POSIX.
## Related
Related commands for Unix text processing sets:
* [`union`](https://github.com/sixarm/union): print lines in (A union B)
* [`intersect`](https://github.com/sixarm/intersect): print lines in (A intersect B)
* [`except`](https://github.com/sixarm/except): print lines in (A except B) a.k.a. (A - B)
* [`extra`](https://github.com/sixarm/extra) : print lines in (A extra B) a.k.a. (B - A)
Examples:
$ cat 1.txt
alpha
bravo
$ cat 2.txt
alpha
charlie
$ union 1.txt 2.txt
alpha
bravo
charlie
$ intersect 1.txt 2.txt
alpha
$ except 1.txt 2.txt
bravo
$ extra 1.txt 2.txt
charlie
## Tracking
* Program: union
* Version: 2.0.2
* Created: 2017-01-30
* Updated: 2017-01-30
* License: GPL
* Contact: Joel Parker Henderson (joel@joelparkerhenderson.com)