Reputation: 2156
I have two files with shown records. How can I get the different records using Shell script/Unix Command. I don't want the common records from the both the files.
Thanks
Upvotes: 1
Views: 512
Reputation: 3084
This should work:
grep -vf File1 File2
grep -vf File2 File1
Thanks for correction @jm666, this is nicer
Upvotes: 2
Reputation: 246774
It would have been nice to be able to copy and paste the input file text. Nevertheless:
comm -3 <(sort file1) <(sort file2) | sed 's/^\t//'
or
awk '
{count[$0]++}
END {for (line in count) if (count[line] == 1) print line}
' file1 file2
Upvotes: 2