Hey....

what i got with the below info is data.file is having
line 'Vijayb:12345:Vijay B bharghav'

$cat data.file
Vijayb:12345:Vijay B bharghav

you want to extract 'bharghav' from the file data.file?
i'm i right?????

if it is that....do like below you will get this...

$cat data.file | awk '{print $3}'

else let me know you required clearly.....

bye 


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 19, 2004 11:29 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Query


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>







-- 
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