Hi everyone,
This is an exemple of inpout.txt file (a "," delimited text file which can be open as csv file):
ID, Code, Value, Store SP|01, AABBCDE, 15, 3 SP|01, AABBCDE, 14, 2 SP|01, AABBCDF, 13, 2 SP|01, AABBCDE, 16, 3 SP|02, AABBCED, 15, 2 SP|01, AABBCDF, 12, 3 SP|01, AABBCDD, 13, 2 SP|02, AABBCDF, 9, 2 SP|01, AABBCDF, 8, 3
The idea is to print rows with the 2 highest values in "Value" column for identical values in "Code" (And also keep the headers)
Exemple of output files:
ID Code Value Store SP|01, AABBCDE, 16, 3 SP|01, AABBCDE, 15, 3 SP|02, AABBCED, 15, 2 SP|01, AABBCDD, 13, 2 SP|01, AABBCDF, 13, 2 SP|01, AABBCDF, 12, 3
I'm new to Linux and have a bit of knowledge in very basic use of AWK, sed, grep ect but I'm unsure how to manipulate the file to get the output as stated above.
Any help would be very much appreciated!