We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
'Sort' command #6
'Sort' command #6
Sort by
recency
|
28 Discussions
|
Please Login in order to post a comment
-t
$'\t': This option specifies that the field separator should be a tab character
\t. The
$'\t'
syntax is a Bash feature that allows you to represent special characters, such as tabs, in a way that the shell can understand.-k2n
: This option tellssort
to sort the file based on the numeric value of the second column. The2
specifies the column number, and then
tells sort to sort the column numerically.I did not know about 3.1.2.4 ANSI-C Quoting so I wrote:
correct answer is `sort -t $'\t' -k2n
but
You can find here HackerRank Linux Shell Solutions
Sort Command #6 HackerRank Solution
sort -t $'\t' -k 2n