I have the following text in a file , it is separated by delimiter(=) , I need to get second highest value for each group of second filed , I have tried below code and able to get the highest value , is there a way we can achieve using Unix command to get the expected output?
First highest Value :
cat File.txt | awk -F= '{if (a[$2] < $1 ) a[$2] = $1;}END{for(i in a )
{print i,a[i];}' OFS='='
Input :
20180526=AA
20180530=BB
20180621=AA
20180630=BB
20180630=CC
20180630=DD
20180731=BB
20180731=CC
20180731=DD
Expected output:
20180526=AA
20180630=BB
20180630=CC
20180630=DD