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,ne xt if !@ARGV; ++$s{$_} for split; if( eof ){ $s{$_}=$s{$_}>=100&&$_ for keys %s}' file file >newfile
Please help with usage.
Thanks
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,ne
Please help with usage.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
A pleasure doing business, FL1