🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.text
Article #6978

Re: Counting and listing words

#6978
From: dkm
Date: Fri, 17 Apr 1998 00:00
28 lines
1296 bytes
Harald Nikolaus <harald@ruprecht.fsk.uni-heidelberg.de> wrote:

>
>Hi,
>
>does anybody know where I can find a program, an add-on, a macro or a 
>Perl module that lists alle the words in a file
>and also, how often they appear?
>Or do I have to write it myself?
>
>Greetings
>Harald
>

How about AWK:

{
for (i = 1; i <= NF; i++) word[$i]++
}
END {for (i in word) print i, word[i]
}

You probably want to eliminate the punctuation first.

For info on AWK, search DejaNews for "FAQ and AWK" in comp.lang.awk.

DKM
Technical Details
Message-ID: <3537bd84.514392617@nntp>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6h84ks$gpp@sun0.urz.uni-heidelberg.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 106cba,8f7b76fcb76708d2
X-Google-Attributes: gid106cba,public
X-Google-Thread: 116e11,8f7b76fcb76708d2
X-Google-Attributes: gid116e11,public
X-Google-Thread: 10bba1,8f7b76fcb76708d2
X-Google-Attributes: gid10bba1,public
X-Google-Thread: 10c853,8f7b76fcb76708d2
X-Google-Attributes: gid10c853,public
From: dkm@cts.com
Subject: Re: Counting and listing words
Date: 1998/04/17
Message-ID: <3537bd84.514392617@nntp>
X-Deja-AN: 345158779
Cache-Post-Path: wagasa.cts.com!unknown@dkm.cts.com
References: <6h84ks$gpp@sun0.urz.uni-heidelberg.de>
Organization: CTS Network Services
Newsgroups: comp.text,comp.os.ms-windows.apps.word-processing,alt.comp.editors.batch,bit.mailserv.word-pc