Created
May 25, 2026 20:44
-
-
Save copyleftdev/57e0327dc16d7e4bcf49b8779f67f078 to your computer and use it in GitHub Desktop.
comm — compare two sorted files: unique to each and shared
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # comm — line-by-line comparison of two sorted files | |
| # Input must be sorted. Use: sort file | sponge file | |
| comm a.txt b.txt # 3 columns: only-A | only-B | both | |
| comm -23 a.txt b.txt # only in A (suppress cols 2 and 3) | |
| comm -13 a.txt b.txt # only in B (suppress cols 1 and 3) | |
| comm -12 a.txt b.txt # in both (suppress cols 1 and 2) | |
| # Sort on the fly with process substitution: | |
| comm -23 <(sort a.txt) <(sort b.txt) | |
| # Compare two model output word lists: | |
| comm -12 <(sort run-a.txt) <(sort run-b.txt) # consistent outputs | |
| comm -23 <(sort run-a.txt) <(sort run-b.txt) # dropped from run B | |
| # Compare dependency lockfiles: | |
| comm -13 <(sort lock-old.txt) <(sort lock-new.txt) # newly added | |
| comm -23 <(sort lock-old.txt) <(sort lock-new.txt) # removed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment