I have data which is colon delimeted as shown:
Joe:23;23;56:zz
Jim:44;44:cz
Rob:45;98:fc
In column 2 if there are more than one value then they need to print separately. Duplicates should be removed and only unique values should also print.
I tried this to remove duplicates:
sort -u -t : -k 2,2 file_name
Output:
Joe:23;23;56:zz
Jim:44;44:cz
Rob:45;98:fc
Desired Output:
Jim:44:cz
Below ones need to print separately because column 2 has more than one value or we can append this output to other file.txt
Joe:23;56:zz
Rob:45;98:fc