Date: Wed, 26 Mar 2003 16:29:40 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Giorgos Keramidas <keramida@ceid.upatras.gr> Cc: freebsd-questions@freebsd.org Subject: Re: perl help Message-ID: <20030326222940.GB38860@dan.emsphone.com> In-Reply-To: <20030326222732.GC19762@gothmog.gr> References: <DAV44DVRXGsNLqY54z30000b1d0@hotmail.com> <20030326222732.GC19762@gothmog.gr>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Mar 27), Giorgos Keramidas said: > On 2003-03-26 14:18, Kenzo <kenzo_chin@hotmail.com> wrote: > > 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 > ... Even better: grep -c 'this' file grep -c 'that' file -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030326222940.GB38860>