I have 2 files for comparison. I want Transfer the different records from both the files in two separate file.
File1
A|B|C|D 1|2|3|5 E|F|G|H File2
A|B|C|D 1|2|3|4 E|F|I|H Output Like... File3.
1|2|3|5 E|F|G|H File4.
1|2|3|4 E|F|I|H You can do this by using comm.
comm file1 file2 -23 > file3 comm file1 file2 -13 > file4 -23 means "only lines unique to FILE1"
-13 means "only lines unique to FILE2"
Try this,
diff File1 File2 | grep "^<" | sed 's/^< //g' > File3 diff File1 File2 | grep "^>" | sed 's/^> //g' > File4 output:
cat File3 1|2|3|5 E|F|G|H cat File4 1|2|3|4 E|F|I|H