Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site cuae2.UUCP Path: utzoo!decvax!ucbvax!ucdavis!lll-crg!lll-lcc!dual!ptsfa!qantel!ihnp4!cuae2!heiby From: heiby@cuae2.UUCP (Heiby) Newsgroups: net.unix Subject: Re: Unique Word Counter Needed Message-ID: <1704@cuae2.UUCP> Date: Wed, 11-Dec-85 15:30:34 EST Article-I.D.: cuae2.1704 Posted: Wed Dec 11 15:30:34 1985 Date-Received: Sat, 14-Dec-85 07:13:47 EST References: <232@ihlpf.UUCP> Reply-To: heiby@cuae2.UUCP (Heiby) Distribution: na Organization: AT&T - /app/eng, Lisle, IL Lines: 18 Here's something I threw together. This sequence assumes that case is not significant. Also, its idea of what is a word may not match yours. For example This will cound troff controls as words. The first "tr" is from the SVR2 tr man page. The text says, "The following example creates a list of all the words in file1 one per line in file2, where a word is taken to be a maximal string of alphabetics." (I am using pipes rather than files, though.) cat FILE | # FILE is the input file tr -cs "[A-Z][a-z]" "[\012*]" | # split the words tr "[A-Z]" "[a-z]" | # make all lower case sort | # sort them uniq | # remove duplicates wc -l # display final count -- Ron Heiby {NAC|ihnp4}!cuae2!heiby Moderator: mod.newprod & mod.unix AT&T-IS, /app/eng, Lisle, IL (312) 810-6109 "I am not a number! I am a free man!" (#6)