Text Processing18 / 18
Up next

comm compare sorted

#!/usr/bin/env bash

a=$(printf '%s\n' apple banana cherry | sort)
b=$(printf '%s\n' banana cherry date | sort)
# comm needs sorted input: col1=only A, col2=only B, col3=both
comm <(echo "$a") <(echo "$b") 
What you're solving

lines only-in-A, only-in-B, or both