[LUGOS] stetje besed v datoteki

cefe cefe at dir-slovenia.com
Mon Jan 2 12:43:03 CET 2006


Matija Grabnar pravi:
> On Mon, Jan 02, 2006 at 11:50:57AM +0100, cefe wrote:
---
> perl -e 'while(<>) {@words=split(/\W+/,$_); foreach $word (@words) {$cnt{$word}++}}; foreach (keys %cnt) {print "$cnt{$_} $_\n"}' 123.txt
> 

Hvala :)

> 
> Mimogrede, tvoja dosedanja metoda daje napacne rezultate:

Ups; se enkrat hvala!
V spodnjem primeru je sicer delalo pravilno:
---
robi at crnc:/tmp$ cat 123.txt
123
223
323
423
523
623
723
223
223
robi at crnc:/tmp$ grep 223 123.txt|wc  --words
3
robi at crnc:/tmp$
---



Aja, zahvala tudi Sasotu za njegovo verzijo.

robi


More information about the lugos-list mailing list