HackerRank - Sort Command #5
April - 25/2025
Problem:
You are given a file of text,which contains temperature information about American cities, in TSV
(tab-separated) format. The first column is the name of the city and the next four columns are the average
temperature in the months of Jan, Feb, March and April (see the sample input). Rearrange the rows of the
table in descending order of the values for the average temperature in January.
# Input
- Albany, N.Y. 22.2 46.6 71.1 49.3 38.60 136 64.4 57
- Albuquerque, N.M. 35.7 55.6 78.5 57.3 9.47 60 11.0 64
- ...
# Output
- Austin, Texas 50.2 68.3 84.2 70.6 33.65 85 0.9 62 / 58
- Baton Rouge, La. 50.1 66.6 81.7 68.1 63.08 110 0.2 52 / 46
- ...
# Solution
sort -r -n -k 2 -t $'\t'
Post: