Link to home
Start Free TrialLog in
Avatar of faithless1
faithless1

asked on

Sort command help

Hello,

I have a file with around 200K records. I'm trying to get the number of occurances of each word with the following command:

tr ' ' '\n' |sort |uniq -c

This command is not sorting correctly...

I'm also using the following command to delete words from the main file which occur less than 100 times which is also not producing correct results.

perl -ne 's/(\S+)/$s{$1}/g,print,next if !@ARGV; ++$s{$_} for split; if( eof ){ $s{$_}=$s{$_}>=100&&$_ for keys %s}' file file >newfile

Please help with usage.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of tel2
tel2
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In what way does the result differ from the correct result?
Having just collected 500 points for asking a few questions, I think I must be getting good at this game.
A pleasure doing business, FL1