Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: File Manipulation

by hdb (Prior)
on Aug 23, 2013 at 11:04 UTC ( #1050635=note: print w/ replies, xml ) Need Help??


in reply to File Manipulation

I would use a simple array of arrays where the first element of each sub-array is the server, like this:

use strict; use warnings; my @logs; while(<DATA>){ push @logs, [ $1 ] if /\[(.*)\]/; push @{$logs[-1]}, $1 if /^(\/.*)/; } print shift @$_, ":", join( ",", @$_ ), "\n" for @logs; __DATA__ [server1] /tmp/location1/file.log /tmp/location2/file.log [server2] /usr/loc1/file.log /usr/loc2/file.log [server3] /citrix/dir3/file.log


Comment on Re: File Manipulation
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2014-09-17 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (72 votes), past polls