Page 1 of 1

Extract data from txt to csv file

Posted: Tue Nov 19, 2013 9:20 pm
by gazdovsky
Hello, I have about 800 txt files with html code.
There are next fragments:
1. I need: 440628-12 and 359.99
var DefaultVAT="$0.00";

var DefaultSku="440628-12";
var DefaultWeight1=4;
var DefaultWeight2=0;
var DefaultPrice="$359.99";
2. I need: 440585_38_FT-dtl.jpg
<td width="33%" class="pcShowAdditionalImage">

<a href="catalog/440585_38_FT-dtl.jpg" class="highslide" onclick="return hs.expand(this, { slideshowGroup: 'slides' })" id="1"><img id="440585_38_FT-dtl.jpg" onmouseover='javascript:window.document.mainimg.src="catalog/440585_38_FT.jpg";linkChanger( "440585_38_FT-dtl.jpg" )' src='catalog/440585_38_FT.jpg' alt="Ski-Doo 2014 Ladies Absolute 0 Jacket - Ice" /></a>

<div class="highslide-caption">Ski-Doo 2014 Ladies Absolute 0 Jacket - Ice</div>
3. I need: Ladies’ version of the jacket worn by Nicolas Musters when he set his guinness world record. A jacket without compromise. It will keep any rider warm in arctic colds while providing a removable liner and ultimate breathability when temperatures become milder. Extremely warm, durable, breathable and reliable. Performance is guaranteed to last season after season. <br /> Sympatex 2-Ply Laminated Polyester <br /> Primaloft One

<!-- Start long product description -->

<table class="pcShowContent">
<tr>
<td><a name="details">&nbsp;</a></td>
</tr>
<tr>
<td class="pcSectionTitle">
Product Details
</td>
</tr>
<tr>
<td style="padding:8px;">
Ladies’ version of the jacket worn by Nicolas Musters when he set his guinness world record. A jacket without compromise. It will keep any rider warm in arctic colds while providing a removable liner and ultimate breathability when temperatures become milder. Extremely warm, durable, breathable and reliable. Performance is guaranteed to last season after season. <br /> Sympatex 2-Ply Laminated Polyester <br /> Primaloft One
</td>
</tr>
<tr>
<td>
<div align='right'><a href='#top'>Back to the top</a></div>
</td>
</tr>
</table>
<!-- End long product description -->

In attachment example of file. Thank you in advance for your help!

Re: Extract data from txt to csv file

Posted: Thu Dec 12, 2013 12:26 pm
by DataMystic Support
1. Use an EasyPattern:

var DefaultVAT="[ capture( 1+not cr or lf or <"> ) as 'DefaultVAT' ]";

var DefaultSku="[ capture( 1+not cr or lf or <"> ) as 'DefaultSku' ]";
var DefaultWeight1=[ capture( 1+not cr or lf or <;> ) as 'DefaultWeight1' ];
var DefaultWeight2=[ capture( 1+not cr or lf or <;> ) as 'DefaultWeight2' ];
var DefaultPrice="[ capture( 1+not cr or lf or <"> ) as 'DefaultPrice' ]";

Replace with:
@DefaultVAT@, @DefaultSku@, etc

2. Use an EasyPattern:

<a href="catalog/[ capture(1+ chars ) as 'filename' ]" class="highslide"

Replace with

@filename@

and check 'Extract '