Re: Fw: perl help

2003-03-27 Thread Nikolay Y. Orlyuk
On Thu, Mar 27, 2003 at 08:45:15AM -0600, Kenzo wrote:
> Bounced
> try again.
> 
> - Original Message -
> From: "Kenzo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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 paul40
> >
> > then if I have a similar sentence like
> > I went to the store with paul and mike
> > the output will would be
> > paul and mike25
??
Where is problem?
> >
> > Thanks.
> >
> > - Original Message -
> > From: "Steve Willoughby" <[EMAIL PROTECTED]>
> > To: "Dan Nelson" <[EMAIL PROTECTED]>
> > Cc: <[EMAIL PROTECTED]>
> > 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
ICQ#: 136497739

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Fw: perl help

2003-03-27 Thread Kenzo

- Original Message -
From: "Nikolay Y. Orlyuk" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 27, 2003 8:57 AM
Subject: Re: Fw: perl help


> On Thu, Mar 27, 2003 at 08:45:15AM -0600, Kenzo wrote:
> > Bounced
> > try again.
> >
> > - Original Message -
> > From: "Kenzo" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > 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 paul40
> > >
> > > then if I have a similar sentence like
> > > I went to the store with paul and mike
> > > the output will would be
> > > paul and mike25
> ??
> Where is problem?

there is not problem.
the scripts works like it's suppose to.
but what I would like now is to display and count the rest of the sentence
not just the next word.

> > >
> > > Thanks.
> > >
> > > - Original Message -
> > > From: "Steve Willoughby" <[EMAIL PROTECTED]>
> > > To: "Dan Nelson" <[EMAIL PROTECTED]>
> > > Cc: <[EMAIL PROTECTED]>
> > > 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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> ICQ#: 136497739
>
> ___
> [EMAIL PROTECTED] mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
"[EMAIL PROTECTED]"
>
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"