Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: parsing help required

by choroba (Abbot)
on Feb 05, 2013 at 12:16 UTC ( #1017140=note: print w/ replies, xml ) Need Help??

in reply to parsing help required

Just go over the lines. If you see a tool, remeber the relevant information. If you see the user, report the remembered information:

#!/usr/bin/perl use warnings; use strict; my $user = shift; my ($tool, $issued, $use); while (<DATA>) { 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
BTW, is the space after galaxy really missing? If no, you can remove the question marks from the regex.
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re: parsing help required
Select or Download Code
Re^2: parsing help required
by ghosh123 (Monk) on Feb 05, 2013 at 13:42 UTC
    Thank you, it helped

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017140]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2014-07-29 14:18 GMT
Find Nodes?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:

    Results (217 votes), past polls