Removing lines that are in fileB from fileA producing fileC

Problem

You have two different files fileA and fileB containing similar records (one record per line), and you would like to remove the records that fileB contains from fileA (subtract) producing a new file (fileC) that contains only records that are contained in fileA with records from fileB removed.

Solution

Use the following grep command

grep -vxf fileB fileA > fileC