Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Storing the log file name as key/value in hash

by huck (Prior)
on Jun 07, 2017 at 04:09 UTC ( [id://1192236]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Storing the log file name as key/value in hash
in thread Storing the log file name as key/value in hash

use strict; use warnings; my %HoA; while (my $line = <DATA>) { chomp $line; my ($col1,$restcol) = split /:\s*/, $line ,2; my ($col2,$col3) = split ' ', $restcol,2; push @{$HoA{$col1}{$col2}},$col3; } print "Dumping Output \n"; for my $col1 (sort keys %HoA) { my $c1txt=$col1; for my $col2 (sort keys %{$HoA{$col1}}) { my $c2txt=$col2; for my $col3 (@{$HoA{$col1}{$col2}}) { printf "%-22s %-22s %-22s \n",$c1txt,$c2txt,$col3; $c1txt=''; $c2txt=''; } } } __DATA__ ULTRIX : CW18.72.0.3 IP-HOST1.log DEC_DECSTATION : CW180.72.0.3 IP_HOST_AL.log DEC_DECSTATION_ADDR : CW180.72.0.3 IP_HOST_al2.log FOR_VISITORS23_HOST : HL617.253.1101.2 IP_HOST_hostinfo.log FOR_VISITORS24_HOST : HL617.253.1101.2 IP_HOST_hostinfo2.log FOR_VISITORS25_HOST : HL617.253.1101.2 IP_HOST_webform3.log FOR_VISITORS25_HOST : HL617.253.1101.2 IP_HOST_webform4.log FOR_VISITORS25_HOST : HL617.253.1201.2 IP_HOST_webform4.log

Dumping Output DEC_DECSTATION CW180.72.0.3 IP_HOST_AL.log DEC_DECSTATION_ADDR CW180.72.0.3 IP_HOST_al2.log FOR_VISITORS23_HOST HL617.253.1101.2 IP_HOST_hostinfo.log FOR_VISITORS24_HOST HL617.253.1101.2 IP_HOST_hostinfo2.log FOR_VISITORS25_HOST HL617.253.1101.2 IP_HOST_webform3.log IP_HOST_webform4.log HL617.253.1201.2 IP_HOST_webform4.log ULTRIX CW18.72.0.3 IP-HOST1.log

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2024-04-19 18:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found