I have record.txt file. And the file contains...
Danna,20,female,City,80.00
Danna,20,female,City,90.00
Jason,22,male,City,90.00
Jason,22,male,City,80.00
Kelly,20,female,City,89.00
Timmy,21,male,City,88.00
Tom,22,male,City,90.00
I only want to check duplicate records for first to fourth column and print the output
Sample output :
Danna,20,female,City,80.00
Danna,20,female,City,90.00
Jason,22,male,City,90.00
Jason,22,male,City,80.00
I've tried this code to get only the duplicates in column 1 to 4, but I don't know how to print it with column 5
awk -F"," '{print $1","$2","$3","$4}' record.txt | sort | uniq -D
What I get is
Danna,20,female,City
Danna,20,female,City
Jason,22,male,City
Jason,22,male,City
What I need to get is this
Danna,20,female,City,80.00
Danna,20,female,City,90.00
Jason,22,male,City,90.00
Jason,22,male,City,80.00