"Juliana Salazar Franco" [email protected] wrote:
Hello there just wondering how you would sort through a data file like arcade.csv that had six fields, say these are separated by commas, how would you clarify your command so that it only sorts through the sixth field in each line? Sort -k6 arcade.csv | uniq -c | sort -k 1nr, would the field be speficied by -k6? i tried this, but it doesn't return the count of repeated lines it just says that every line is unique so it returns the count as 1 for every line.
Hi Juliana,
By doing sort -k 6 you are sorting the entire lines based on the 6th field. BTW, the comparison is alphabetic but you'd expect Score to be a number, so as things stand "100" is less than "60". Putting that to one side, if you are comparing entire lines you'd hope that there are no repeats. What you need to do is cut the column and then sort what would then be a single column, or sort the lines based on the column of interest, and then cut out that column. Different ways of achieving the same thing.
Cheers
MichaelW