From owner-freebsd-questions@FreeBSD.ORG Thu Mar 27 06:57:35 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 B15C637B401 for ; Thu, 27 Mar 2003 06:57:35 -0800 (PST) Received: from relay1.ntu-kpi.kiev.ua (oberon.ntu-kpi.kiev.ua [195.245.194.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 61B4F43F75 for ; Thu, 27 Mar 2003 06:57:34 -0800 (PST) (envelope-from nikolay@asu.ntu-kpi.kiev.ua) Received: by relay1.ntu-kpi.kiev.ua (Postfix, from userid 426) id 8490119C20; Thu, 27 Mar 2003 16:57:31 +0200 (EET) Received: from onyx.asu.ntu-kpi.kiev.ua (eth0.onyx.asu.ntu-kpi.kiev.ua [10.18.16.2]) by relay1.ntu-kpi.kiev.ua (Postfix) with ESMTP id 0283419BFB for ; Thu, 27 Mar 2003 16:57:30 +0200 (EET) Received: from drweb by onyx.asu.ntu-kpi.kiev.ua with drweb-scanned (Exim 4.10) id 18yYor-0005JV-00 for freebsd-questions@FreeBSD.ORG; Thu, 27 Mar 2003 16:57:29 +0200 Received: from nikolay by onyx.asu.ntu-kpi.kiev.ua with local (Exim 4.10) id 18yYor-0005JP-00 for freebsd-questions@FreeBSD.ORG; Thu, 27 Mar 2003 16:57:29 +0200 Date: Thu, 27 Mar 2003 16:57:29 +0200 From: "Nikolay Y. Orlyuk" To: freebsd-questions@FreeBSD.ORG Message-ID: <20030327145729.GF13349@asu.ntu-kpi.kiev.ua> Mail-Followup-To: freebsd-questions@FreeBSD.ORG References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i X-Spam-Status: No, hits=-32.5 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MUTT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Subject: Re: Fw: 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: Thu, 27 Mar 2003 14:57:36 -0000 On Thu, Mar 27, 2003 at 08:45:15AM -0600, Kenzo wrote: > Bounced > try again. > > ----- Original Message ----- > From: "Kenzo" > To: > Sent: Thursday, March 27, 2003 8:28 AM > Subject: Re: perl help > > > > This works great. > > now I just realized something else. > > What if I wanted to show and count everything after a specific word. > > > > if I have a sentence like this. > > I went to the store with joe/mike and paul > > > > I want to show how many times "joe/mike and paul" appears. > > > > The script below will only show joe if I input the word with. > > so the desired output would be > > joe/mike and paul 40 > > > > then if I have a similar sentence like > > I went to the store with paul and mike > > the output will would be > > paul and mike 25 ?? Where is problem? > > > > Thanks. > > > > ----- Original Message ----- > > From: "Steve Willoughby" > > To: "Dan Nelson" > > Cc: > > Sent: Wednesday, March 26, 2003 4:47 PM > > Subject: Re: perl help > > > > > > > > In the last episode (Mar 27), Giorgos Keramidas said: > > > > > On 2003-03-26 14:18, Kenzo wrote: > > > > > You don't need Perl for that. Here's a small trick: > > > > > grep 'this' file | wc -l > > > > > grep 'that' file | wc -l > > > > Even better: > > > > grep -c 'this' file > > > > grep -c 'that' file > > > > > > Unfortunately, that's not what he was asking for, which is to look for > > > the pattern "big " where all the possible s are unknown and > > > report on all the s that were found. > > > > > > So something like: > > > > > > while (<>) { > > > while (/big\s+(\w+)/g) { > > > $count{$1}++; $_=$'; > > > } > > > } > > > > > > foreach $word (sort(keys(%count))) { > > > print "$word: $count{$word}\n"; > > > } > > > > > > > > > ought to do the trick. Play with $/, etc if you want to allow big and > > > to be across a newline from each other. I can't understand this messages. Please say what you want and which problems meeted while you solve it. -- With best wishes Nikolay mail: nikolay@asu.ntu-kpi.kiev.ua ICQ#: 136497739