From owner-freebsd-questions@FreeBSD.ORG Wed Mar 26 14:27:39 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1257337B405 for ; Wed, 26 Mar 2003 14:27:38 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC54543FA3 for ; Wed, 26 Mar 2003 14:27:36 -0800 (PST) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a161.otenet.gr [212.205.215.161]) by mailsrv.otenet.gr (8.12.8/8.12.8) with ESMTP id h2QMRXh1026865; Thu, 27 Mar 2003 00:27:34 +0200 (EET) Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.12.8/8.12.8) with ESMTP id h2QMRWOD020358; Thu, 27 Mar 2003 00:27:32 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.12.8/8.12.8/Submit) id h2QMRWHt020357; Thu, 27 Mar 2003 00:27:32 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Thu, 27 Mar 2003 00:27:32 +0200 From: Giorgos Keramidas To: Kenzo Message-ID: <20030326222732.GC19762@gothmog.gr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-RAVMilter-Version: 8.4.2(snapshot 20021217) (terpsi) X-Spam-Status: No, hits=-25.3 required=5.0 tests=AWL,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, RCVD_IN_UNCONFIRMED_DSBL,REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) cc: freebsd-questions@freebsd.org Subject: Re: perl help X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Mar 2003 22:27:40 -0000 On 2003-03-26 14:18, Kenzo wrote: > I don't know how to write anything in perl and will eventually learn it. > but I was wondering if anyone would help write a quick perl script for me. > > Basically I want the script to look thru a file for certain words and cound > how many times it finds the word that comes after. > I have a log file that keeps track of E-mail attachments being send and > received, and I want to be able to do a count of certain attachments. > for example. say I see alot of "big this", "big that" and "big nothing" > I want to be able to see how many times the word that comes after big > appears in the log file. > so the output would be like this. > this 5 > that 10 > nothing 20 You don't need Perl for that. Here's a small trick: grep 'this' file | wc -l grep 'that' file | wc -l ... - Giorgos