Thanks everyone I will be putting this into practice asap to save my fingers.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Carl J. Bauman
Sent: Tuesday, March 23, 2004 12:13 AM
To: [EMAIL PROTECTED]
Subject: Re: [newbie] xml and grep


[EMAIL PROTECTED] wrote:

>On Mon, Mar 22, 2004 at 02:53:50PM +0000, Tony S. Sykes wrote:
>  
>
>>Help, I have my web limited by my company now, so I can't google till tomorrow. I 
>>need help with parsing an xml file. I need to cut out a fax number from the file. 
>>Easy enough I though just grep and cut the line, but the whole file is one line. I 
>>know this is a simple command but I can't work it out on my own, and with out google 
>>(strange how easy you get attached to things) I am stuck. Please help.
>>
>>Thanks,
>>
>>Tony.
>>    
>>
>
>So, assuming the xml fax line was something like
>
><fax>123-456-7890</fax>
>
>  
>

Assuming the same tags as above, this would probably work also:

    cat fax.xml | perl -n -e ' print "$1\n" if /<fax>(.+)<\/fax>/; '

HTH,
Carl




-+-+-+-+-+-+-+-+-+ Business Computer Projects - Disclaimer -+-+-+-+-+-+-+-+-+-
This message, and any associated attachment is confidential.  If you have recieved
it in error, please delete it from your system, do not use or disclose the information
in any way, and notify either the sender or [EMAIL PROTECTED] immediately.
The contents of this message may contain personal views which are not necessarily 
the views of Business Computer Projects Ltd., unless specifically stated.  Whilst every
effort has been made to ensure that emails and their attachments are virus free, it is 
the responsibility of the recipient(s) to verify the integrity of such emails.
Business Computer Projects Ltd
BCP House
151 Charles Street
Stockport
Cheshire
SK1 3JY
Tel: +44 (0)161 355-3000
Fax: +44 (0)161 355-3001
Web: http://www.bcpsoftware.com

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com
____________________________________________________
Join the Club : http://www.mandrakeclub.com

Reply via email to