It's UWAweek 19

helpOSTS

This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying selected article
Showing 1 of 411 articles.
Currently 12 other people reading this forum.


SVG not supported

Login to reply

👍x1
helpful
3:06pm Fri 24th Mar, Michael W.

"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

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy