consider the scenario-
file1:
mike;john;552
mike;mike;555
john;mike;121
file2:
aks;raj;425
man;joe;895
mike;john;552
Assuming file1 and file2 contain the above two sets of data. I would like to put the data from these two files into another file , where the data is uniq ( meaning: file1 and file2 contain common data mike;john;552, but when conbining files i do not want to have duplicates.
I used the command:
cat file1 file2 | sort -u > file3
but this gave me only the common line ie, the duplicate into file3.
Also tried
cat file1 file2 | uniq > file3
Didnt yield required result.
Expected output: file3:
mike;john;552
mike;mike;555
john;mike;121
aks;raj;425
man;joe;895
Note: the data in file3 can be in any order.
Please help on this.
cat file1 file2 | sort -uworks well for me: all lines from file1 and file2 merged and duplicate lines are printed only once. - Lars Fischer