Below was my input file, but my actual input has millions of records,
004,[email protected],TAT,0582,live,20180622 06:27:47
004,[email protected],TAT,0588,live,20180622 06:27:27
004,[email protected],TAT,0562,live,20180622 06:27:59
004,[email protected],TAT,0582,inlive,20180622 06:27:47
006,[email protected],TAT,0582,live,20180622 06:27:47
004,[email protected],TAT,0582,live,20180622 06:27:47
Firstly I would Like to sort the above file using Second column(email) ascending order, secondly I want to sort it using 6th column (timestamp) in descending order. Third, I need to remove the duplicate based second column.
Expected Output:
004,[email protected],TAT,0582,inlive,20180622 06:27:47
004,[email protected],TAT,0588,live,20180622 06:27:27
006,[email protected],TAT,0582,live,20180622 06:27:47
004,[email protected],TAT,0562,live,20180622 06:27:59
004,[email protected],TAT,0582,live,20180622 06:27:47
what I tried, but I want to do all in single command instead of different step also the duplicate removal wasn't happening properly with -u?
sort -t$'," -k2 pp.txt > pp1.txt
sort -t$'," -k6 -r pp1.txt > pp2.txt
sort -t$'," -k2 -u pp2.txt > pp3.txthere
Please help