Re: [newbie] Number of occurrences of each word in a text file

2004-08-20 Thread b311b-mandrake
On Fri, 20 Aug 2004 15:13:16 +0100 Paul Smith wrote: > michael higgins wrote: > > perl -e 'open F,"<:encoding(iso-8859-9)",$ARGV[0];for(){for(split > > /\W+/,$_){$t{lc $_}++}}for(map{$_->[0]}sort {$a->[1] <=> $b->[1]|| > > $a->[0] cmp $b->[0]}map{[$_,$t{$_}]} keys %t){print $_, " => ", $t{$_},

Re: [newbie] Number of occurrences of each word in a text file

2004-08-20 Thread Paul Smith
michael higgins wrote: perl -e 'open F,"<:encoding(iso-8859-9)",$ARGV[0];for(){for(split /\W+/,$_){$t{lc $_}++}}for(map{$_->[0]}sort {$a->[1] <=> $b->[1]|| $a->[0] cmp $b->[0]}map{[$_,$t{$_}]} keys %t){print $_, " => ", $t{$_}, "\n"}' thenews.txt Thanks, Mike. It also works for me. I will try to

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread michael higgins
Paul Smith wrote: michael higgins wrote: Does somebody know about a program for giving us the number of occurrences of each word in a text file? Well, this sounds like a good job for perl... perl -e 'open F,$ARGV[0];for(){for(split /\W/,$_){$t{lc $_}++}}for(sort keys %t){print $_, " => ", $t{$_}

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Paul Smith
michael higgins wrote: Does somebody know about a program for giving us the number of occurrences of each word in a text file? Well, this sounds like a good job for perl... perl -e 'open F,$ARGV[0];for(){for(split /\W/,$_){$t{lc $_}++}}for(sort keys %t){print $_, " => ", $t{$_}, "\n"}' forums.txt

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Russ Kepler
On Thursday 19 August 2004 07:43 am, Todd Slater wrote: > I did that in step 1. I suppose you could also just use the -i switch to > uniq to ignore case, so we might end up with > > tr ' \011' '\012\012' < text.txt | tr -d [:punct:] | sort | uniq -ic That's a new one for me - never noticed the -i

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread michael higgins
Todd Slater wrote: On Thu, Aug 19, 2004 at 11:29:22AM +0100, Paul Smith wrote: Dear All Does somebody know about a program for giving us the number of occurrences of each word in a text file? Thanks in advance, Paul I don't know of a program that does it--perhaps it's built in to a word processo

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Todd Slater
On Thu, Aug 19, 2004 at 08:30:25AM -0500, Mikkel L. Ellertson wrote: > Paul Smith wrote: > > >Dear All > > > >Does somebody know about a program for giving us the number of > >occurrences of each word in a text file? > > > >Thanks in advance, > > > >Paul > > > > > I am not at my Linux box at the

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Todd Slater
On Thu, Aug 19, 2004 at 07:37:25AM -0600, Russ Kepler wrote: > On Thursday 19 August 2004 06:45 am, Todd Slater wrote: > > > 2. Get unique words to count from masterwordlist. > > > >uniq masterwordlist > uniqwords > > > > 3. Count the number of times a word in uniqwords appears in > >maste

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Russ Kepler
On Thursday 19 August 2004 06:45 am, Todd Slater wrote: > 2. Get unique words to count from masterwordlist. > >uniq masterwordlist > uniqwords > > 3. Count the number of times a word in uniqwords appears in >masterwordlist. > >for line in `cat uniqwords` ; do echo $line : `grep -c $lin

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Mikkel L. Ellertson
Paul Smith wrote: Dear All Does somebody know about a program for giving us the number of occurrences of each word in a text file? Thanks in advance, Paul I am not at my Linux box at the moment, but if I remember right, the command you want it wc. Mikkel -- Do not meddle in the affairs of d

Re: [newbie] Number of occurrences of each word in a text file

2004-08-19 Thread Todd Slater
On Thu, Aug 19, 2004 at 11:29:22AM +0100, Paul Smith wrote: > Dear All > > Does somebody know about a program for giving us the number of > occurrences of each word in a text file? > > Thanks in advance, > > Paul I don't know of a program that does it--perhaps it's built in to a word processor