Shell Script - comparing lines of text, deleting matches Shell Script - comparing lines of text, deleting matches shell shell

Shell Script - comparing lines of text, deleting matches


grep -F -x -f b.txt -v a.txt > c.txt

or, equivalently,

fgrep -x -f b.txt -v a.txt


Use comm command like this:

cat a.txt | sort > a2.txtcat b.txt | sort > b2.txtcomm -23 a2.txt b2.txt > c.txt


awk 'FNR==NR{_[$1];next}(!($1 in _))' b.txt a.txt > c.txt