Extract line from XML files and combine into one CSV file

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

jolint
Posts: 1
Joined: Wed Apr 16, 2008 11:55 pm

Extract line from XML files and combine into one CSV file

Postby jolint » Thu Apr 17, 2008 12:01 am

Hi,

I need to extract a line in the form of <value> ... </value> from an XML file in a set of XML files (in a sub-directory structure).

Then place the filename of each XML file & the corrosponding values into a CSV file, one row for each XML filename.

Any ideas?

Thanks.

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Extract line from XML files and combine into one CSV file

Postby DataMystic Support » Thu Apr 17, 2008 11:48 am

Easy, use a perl search/replace pattern with Extract Option turned on.

Search for:

Code: Select all

<value>(.*)</value>

Replace with:

Code: Select all

"@fullInputFilename","$1"\r\n

and ensure you use the output filter option to send all output to a single file
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 7 guests