Hi I have a file with following records
It contains three months of data, some data is duplicated,i need to access the latest data from the duplicate ones.
for e.g; i have foll data
"200","0","","11722","-63","","","","11722","JUL","09"
"200","0","","11722","-63","","","","11722","JUL","09"
"200","0","","11722","-63","","","","11722","JUL","09"
"200","0","","11722","-63","","","","11722","JUN","09"
"200","0","","11722","-63","","","","11722","JUN","09"
As it can be seen that the records are same with difference of the month,i want to delete the duplicate records and keep the records with the latest month value
e.g; if i consider the 3rd and 5th record both are same in terms of data but i need the latest data to persist in file, which in this case it is JUl 09.
The problem is if i sort the data i will get JUN09 data as alphabetic wise JUN comes first,whereas i need JUL 09 data, if i sort it descending same problem occurs for different months. The uniq command is also not giving me the right output.
According to my logic i thought of converting the Month name to month number, and concatenate it with the year column, then sort and delete the duplicate lines, but its not working fine
Could you please suggest a shell script on this scenario.
I have data till 2011