5

Sorting by length

view full story
linux-howto

http://www.unix.com – Hello, I have a very large file: a dictionary of headwords of around 40000 and would like to have the dictionary sorted by its length i.e. the largest string first and the smallest at the end. I have hunted for a perl or awk script on the forum which can do the job but there is none available. I am a newbie to Perl and more accustomed to C programming. The C program I wrote takes ages and I believe Perl or Awk are blazing fast. Could anybody provide me with a script and if possible help me out by useful comments so that I can start off writing scripts on my own. Many thanks for your kind (HowTos)