Artificial intelligent assistant

Sorting multiple columns, with the second column being sorted by numerical order file: nameslist.txt Emily 0 Emily 1 Emily 5 Joe 0 Joe 10 Joe 5 Joe 6 This is the command I ran: cat nameslist.txt | sort -k1 -k2 The result: Emily 0 Emily 1 Emily 5 Joe 0 Joe 10 Joe 5 Joe 6 It looks like it's sorting by the first number, but how can I get the second column to sort numerically? The result I want is: Emily 0 Emily 1 Emily 5 Joe 0 Joe 5 Joe 6 Joe 10

Use the `-n` option to sort numerically:


sort -k1,1 -k2n nameslist.txt


There is no need to use `cat` to read the input file. `sort` will do that without needing another process.

The `-k1,1` notation sets the start and stop limits of the first sort key to the first field.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2462cba9dfe228b5efd907fc7827cffa