Files
oam/knowledge base/comm.md
2022-10-13 16:32:02 +02:00

572 B

comm

comm requires the files it is working with to be pre-sorted.

TL;DR

# Print unique lines of file1 which are not present in file2.
comm -23 <(sort -u 'file1') <(sort -u 'file2')

# Check the whole content of file1 is present in file2.
[[ $(comm -23 <(sort -u 'file1') <(sort -u 'file2') | wc -l) -eq 0 ]]

Sources