Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Sort words based on word count on each line

$
0
0
Hi Folks :)

I have a .txt file with thousands of words. I'm trying to sort the lines in order based on number of words per line.

Example

from:
Code:

word
word word word
word word
word word word word
word
word word word
word word


to desired output:
Code:

word
word
word word
word word
word word word
word word word
word word word word


Any help would be greatly appreciated.
Thanks for your help!

ps. Hope i posted this in the correct forum board. My apologies if it's in the wrong section

Viewing all articles
Browse latest Browse all 16232

Latest Images

Trending Articles



Latest Images