<?xml version="1.0" encoding="windows-1252"?>
<node id="1017140" title="Re: parsing help required" created="2013-02-05 07:16:27" updated="2013-02-05 07:16:27">
<type id="11">
note</type>
<author id="832495">
choroba</author>
<data>
<field name="doctext">
Just go over the lines. If you see a tool, remeber the relevant information. If you see the user, report the remembered information:
&lt;c&gt;#!/usr/bin/perl
use warnings;
use strict;

my $user = shift;
my ($tool, $issued, $use);
while (&lt;DATA&gt;) {
    if (my ($t, $i, $u) = /^Users of (.*?) ?\(total ([0-9]+) licenses issued; total ([0-9]+) license/) {
        ($tool, $issued, $use) = ($t, $i, $u);
    }
    if (/^$user,(.*)/) {
        print "Using $tool since $1 (issued $issued, in use $use)\n";
    }
}

__DATA__
Users of spice (total 20 licenses issued; total 0 license in use)
Users of runner (total 10 licenses issued; total 0 license in use)
Users of monitor(total 10 licenses issued; total 2 license in use)
Alex,Mon 20 Jan 2013
Peter,Wed 26 Jan 2013
Users of report (total 15 licenses issued; total 0 license in use)
Users of galaxy(total 10 licenses issued; total 3 license in use)
Martin,Fri 22 Jan 2013
Alex,Mon 21 Jan 2013
Peter,Wed 24 Jan 2013
&lt;/c&gt;
BTW, is the space after &lt;c&gt;galaxy&lt;/c&gt; really missing? If no, you can remove the question marks from the regex.
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-832495"&gt;

&amp;#1604;&amp;#1405;&amp;#4285;† &amp;#6514;&amp;#6482;&amp;#9898;&amp;#10186;&amp;#4281;&amp;#5651;&amp;#5511; &amp;#5045;&amp;#5651;&amp;#5511;&amp;#9137; &amp;#4281;&amp;#6514;&amp;#119243;&amp;#409;&amp;#5651;&amp;#5511;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1017139</field>
<field name="parent_node">
1017139</field>
</data>
</node>
