I have an HTML file. Here is a sample
<div class="criteria" style="padding-left:0;font-style:italic"> You searched for:
<span title="A*" >Individual: <span><b>A*</b></span></span>
</div>
</td>
</tr>
</table>
<table cellpadding="5" cellspacing="0" border="0" style="border-collapse: collapse; width: 100%">
<tr class="ListItemColorNew">
<td style="width:50%">
<div class="gvListItemStyle">
<span class="LargeText15">JAMES BOND A'MONEYPENNY </span> (LIC# 1111111)
<div class="GrayTextShade"><i>Alternate Names: BOND JAMES</i></div>
<div class="GrayTextShade">
GREY TIDE LLC (LIC# 2222)
</div>
</div>
</td>
<td style="width:50%">
<div class="gvListItemStyle">
<span class="LargeText15">FRANK WHITE A'SMALLS </span> (LIC# 1111111)
<div class="GrayTextShade"><i>Alternate Names: JAMES SMALLS</i></div>
<div class="GrayTextShade">
WEST RIVER CORP LLC (LIC# 3333)
</div>
</div>
</td>
<td style="width: 25%; vertical-align: top">
<div class="gvListItemStyle">
<div><img alt="help" src=\'/Content/images/BrokerCheck/icon-blueCheck.png\' style=\'vertical-align:top;padding-right:5px\' />Broker</div>
</div>
</td>
<td style="width:25%;text-align:right;vertical-align:top">
<div class="gvListItemStyle">
<a class="btn btn-primary" href="/Individual/Summary/5820616">Details »</a> </div>
</td>
</tr>
I'm trying to extract everything between <td style="width:50%">
and </td>
. The data is stored in a file testFile.txt
.
This is the Perl code I used
system("perl -pi.bak -e '/^<td style=\"width:50%\">.+<\\/td>/mg' testFile.txt";