Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2014-07-13 16:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls