in reply to Find most frequently used word in text file.
(Use single quotes, if run on linux).perl -anE "for (@F){s/\W//g;$_ or next; $h{$_}++}}{$k=(sort {$h{$a} <= +> $h{$b}} keys %h)[-1]; say qq|The most frequent word in $ARGV is $k, + which was seen $h{$k} times.|" **YOUR-FILE-NAME**
When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
|
|---|