HackerRank Sort Command #7 problem solution YASH PAL, 31 July 2024 In this HackerRank Sort Command #7 problem solution 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).You need to sort this file in descending order of the second column (i.e. the average monthly temperature in January).Input FormatA text file with multiple lines of pipe-delimited data. The first five fields have been explained above Output FormatSort the data in descending order of the average monthly temperature in January. introductionIn Linux, the most vanilla version of ‘sort’ simply rearranges the lines in a file, in lexicographical order. Using a variety of flags and options, sorting can also be extended in various powerful ways. The command can also be used for sorting tables of data, delimited by commas (csv) or tabs (tsv) or even spaces; on a particular column or field. The -k option helps sort the input file on a particular field, i.e. the column number. The -t option helps specify the delimiting character depending on the file format.For example, we’d use:-t $’t’ for a tab-delimited file -t’,’ for a comma delimited file -t’|’ for a pipe delimited fileProblem solution.sort -n -r -t'|' -k2Second solution.sort -t'|' -k 2 -n -rThird solution.sort -t '|' -k2 -nr Fourth solution.cat | sort -n -r -k2 -t '|' coding problems solutions linux shell