HackerRank - 'Sort' command #7
April - 25/2025
Problem:
You are given a file of pipe-delimited weather data (TSV). There is no header column in this data file. The
first five columns of this data are: (a) the name of the city (b) the average monthly temperature in Jan (in
Fahreneit). (c) the average monthly temperature in April (in Fahreneit). (d) the average monthly temperature
in July (in Fahreneit). (e) the average monthly temperature in October (in Fahreneit).<< /h4>
# 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 $'|'
Post: