Score:0

Sorting textfile with rows of [word number] numerically

ci flag

I have a .txt file that consists of:

Aa 6
Bb 3
Aa Aa 2
Bb Bb 10

I need to sort it so the result is:

Bb Bb 10
Aa 6
Bb 3
Aa Aa 2

This only gives the alphabetical order:c

cat .txt | sort -n

Can you help here? Kind regards Anders

Will avatar
id flag
What are your sorting criteria?
bac0n avatar
cn flag
Related: [How to numerical sort by last column?](https://unix.stackexchange.com/a/10528/380915)
Anders Begtorp avatar
ci flag
Thank you for answering! The problem is that the sorting has to be done in both second and third column. Another way to get around this problem: how to make the output of the input sorted in third column? Then I can solve the by the third column afterwards
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.