COMBINE(1)
π COMBINE(1) β the moreutils one, bestie
okay so this is the combine page from the moreutils collection, and honestly? it's giving "two files walk into a bar and get boolean-ed" π₯
β¨ NAME β¨
combine β combine sets of lines from two files using boolean operations π
π¦ SYNOPSIS π¦
combine file1 and file2
combine file1 not file2
combine file1 or file2
combine file1 xor file2
_ file1 and file2 _
_ file1 not file2 _
_ file1 or file2 _
_ file1 xor file2 _
π yes bestie both forms are real, the underscore one is the cute little syntactic-sugar version, more on that below.
π DESCRIPTION π
so combine takes the lines in two files and smushes them together β but how it smushes them depends entirely on which boolean operation you picked. four flavours, pick your fighter:
andβ outputs lines that are in file1 if they are also present in file2. both-or-nothing energy πnotβ outputs lines that are in file1 but not in file2. exes-only, we're removing them πorβ outputs lines that are in file1 or file2. everyone's invited πxorβ outputs lines that are in either file1 or file2, but not in both files. exclusive little icon, no gatecrashers π
"-" can be specified for either file to read stdin for that file. π yes literally the dash, it's not a typo, it means stdin, iykyk.
β οΈ okay important vibe check: the input files need not be sorted, and the lines are output in the order they occur in file1 (followed by the order they occur in file2 for the two "or" operations). keep that in your notes bestie π
and because of that ordering thing? the operations are not commutative π "a and b" will not necessarily be the same as "b and a". to obtain commutative behavior, sort and uniq the result. fr fr, do it.
also β tiny fun fact πΈ β this program can be installed as "_" to allow for the syntactic sugar shown in the latter half of the synopsis (similar to the test/[ command). it is not currently installed as "_" by default, but you can alias it to that if you like. main character workaround, honestly π«Ά
π SEE ALSO π
join(1)β go say hi, it's the cousin π
π AUTHOR π
Copyright 2006 by Joey Hess <id@joeyh.name> π
Licensed under the GNU GPL. π
okay that's the whole page, no cap, nothing skipped π§ and a lil sign-off for you: this is the moreutils page, dated 2025-06-30, so go forth and boolean your lines πβ¨π
π¦ where this page comes from
- alpine 3.24: moreutils-doc 0.70-r1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms