I think you forgot this is the perl list not the awk list

But anyway in perl I will  do something like
perl -ne 'print if(((split(/:/,$_))[2]) =~/\bbhargav\b/)' data.file


Ram


On Wed, 2004-05-19 at 11:29, [EMAIL PROTECTED] wrote:
> I am using the below command
> 
> awk -F: ' $3 ~/bharghav/ { print $0 } ' data.file
> 
> but this command produces both
> Vijayb:12345:Vijay B bharghav
> vijaya:12347:vijaya bharghavi
> 
> what to if I want only record containing exactly the word "bharghav"
> that is 
> Vijayb:12345:Vijay B bharghav
> 
> 
> -----Original Message-----
> From: John W. Krahn [mailto:[EMAIL PROTECTED]
> Sent: Monday, May 17, 2004 4:56 PM
> To: Perl Beginners
> Subject: Re: Query
> 
> 
> On Monday 17 May 2004 03:15, Sudhindra Bhat wrote:
> >
> > Hi
> 
> Hello,
> 
> > I wanted some help on a piece of code that I was writing. Well the
> > requirement is like this. I have a file whose looks like this
> >
> > (1)     Test: 123456 ABCDEF
> >
> > 123456
> >
> > (2)     Results: ABCDEF
> >
> > Now I want my script to output all the contents between the two tags
> > Test and Results. i.e. 123456 ABCDEF 123456. Can someone help me with
> > this?
> 
> 
> while ( <FILE> ) {
>     if ( /Test:/ .. /Results:/ and !/Test:/ and !/Results:/ ) {
>         print
>         }
>     }
> 
> 
> 
> John
> -- 
> use Perl;
> program
> fulfillment
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
> 
> ************************************************************************** 
> This email (including any attachments) is intended for the sole use of the
> intended recipient/s and may contain material that is CONFIDENTIAL AND
> PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
> distribution or forwarding of any or all of the contents in this message is
> STRICTLY PROHIBITED. If you are not the intended recipient, please contact
> the sender by email and delete all copies; your cooperation in this regard
> is appreciated.
> **************************************************************************


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to