Sample Header Ad - 728x90

Keep unique values (comma separated) from each column

5 votes
6 answers
962 views
I have a .tsv (tab-separated columns) file on a Linux system with the following columns that contain different types of values (strings, numbers) separated by a comma:
col1    col2	
.       NS,NS,NS,true,true		
.       12,12,12,13	
1,1,1,2	door,door,1,1
I would like to keep the unique values (unfortunately I tried but couldn't). This would be the output:
col1 col2	
.    NS,true		
.    12,13	
1,2  door,1
Asked by df_v (51 rep)
Oct 20, 2023, 01:48 PM
Last activity: Oct 23, 2023, 08:46 AM