Probably this is a very basic question for shell programmers.
But suppose I have a text file A and B
and B is a subset of A.
I want to create a text file C which contains (A-B) data.
So omit all the common lines .
The line in files are numeric data: like
id , some aspect, other aspec.
Thanks.
Use
sortanduniqIf you want the lines that are the same between A and B, you can use
uniq -dThis assumes of course that the data in A and B are exactly the same. There cannot be any lose spaces or tabs in the datasets. If there are, you’ll have to clean up the data with
sed,tr, orawkfirst.Edit
As Peter. O pointed out, this will fail if there happen to be exact duplicates in file
a. If that’s an issue, you can fix it by doing this: