Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to sort list based on word count ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to sort list based on word count ?

for example i have word lists :

good vps

bad vps

good vps company

vps

dedi

q4 top vps provider

i want to sort it based on word count so the result is :

vps

dedi

bad vps

good vps

good vps company

q4 top vps provider

how to do that? already search but have not found an answer. Word lists around 8k lines. Please help. Thanks.

Comments

  • fxffxf Member
    edited October 2016

    do you have access to a shell on linux or something similar? take an unsorted list of lines of words in unsorted.txt and enter this shiz

    fxf@box:~$ awk '{print NF,$0}' unsorted.txt | sort -n | cut -d' ' -f2- | tee -a sorted.txt

    and presto you have pretty lines in sorted.txt

  • mexyulmexyul Member
    edited October 2016

    @fxf said:
    do you have access to a shell on linux or something similar? take an unsorted list of lines of words in unsorted.txt and enter this shiz

    fxf@box:~$ awk '{print NF,$0}' unsorted.txt | sort -n | cut -d' ' -f2- | tee -a sorted.txt

    and presto you have pretty lines in sorted.txt

    yes i have access to shell. Thanks it's works.

  • Shell thanks

    Thanked by 1yomero
  • @fxf said:
    `fxf@box:~$ awk '{print NF,$0}' unsorted.txt

    you sneaky dragon :) i liked how you thought of it, thanks

Sign In or Register to comment.