Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: one liner to print out sorted list of word

by dakkar (Hermit)
on Mar 26, 2003 at 18:37 UTC ( #246038=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -ne '$_=lc;s/\W+/ /g;@w{split /\s+/}=();END{$,="\n";print sort ke
    +ys %w}'
    
  2. or download this
    while (<>) { # for each input line
     $_=lc;      # lowercase
    ...
    }
    $,="\n";     # separate 'print' args with a newline
    print sort keys %w; # print the sorted keys
    
  3. or download this
    tr -cs '[:alnum:]' '\n' < textfile |tr '[:upper:]' '[:lower:]'|sort|un
    +iq
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://246038]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2022-09-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?