M
Mista_Blista
Hello:
I am analyzing boot logs for a report. The lines in the log I am concerned with look like:
Oct 2 14:56:09 bootpd: info(6): DNCS CAQAM[qam_172.16.31.76:ht=ethernet:sm=255.255.255.0:ip=172.16.31.76:ha=0x0002DE821E07:
This is the code I have so far:
#!/usr/bin/perl -w
while($line = <STDIN>) {
if($line =~ /CAQAM/) {
$line =~ s/qam_/qam_ /g;
$line =~ s/:ht=/ :ht=/g;
@columns = split(/\s+/, $line);
$boot_entry = ("$columns[0]" . ' ' . "$columns[1]" . ' ' . "$columns[2]" . ' ' . "$columns[7]" . "\n");
push(@output, $boot_entry);
}
}
Below is an example of a line of output:
Oct 13 17:21:15 172.16.35.35
Below is what'd I'd like to achieve. The main question I pose is how to store the previous date and only begin a new column when the date has changed? I am hacking away at the llama and the camel, man even the dummies book but I need this report automated very soon.
Oct 2,Oct 4
14:56:09 172.16.31.76,13:33:38 172.16.34.200
14:56:11 172.16.31.74,14:08:36 172.16.32.198
Thanks for any feedback at all. Even flames
I am analyzing boot logs for a report. The lines in the log I am concerned with look like:
Oct 2 14:56:09 bootpd: info(6): DNCS CAQAM[qam_172.16.31.76:ht=ethernet:sm=255.255.255.0:ip=172.16.31.76:ha=0x0002DE821E07:
This is the code I have so far:
#!/usr/bin/perl -w
while($line = <STDIN>) {
if($line =~ /CAQAM/) {
$line =~ s/qam_/qam_ /g;
$line =~ s/:ht=/ :ht=/g;
@columns = split(/\s+/, $line);
$boot_entry = ("$columns[0]" . ' ' . "$columns[1]" . ' ' . "$columns[2]" . ' ' . "$columns[7]" . "\n");
push(@output, $boot_entry);
}
}
Below is an example of a line of output:
Oct 13 17:21:15 172.16.35.35
Below is what'd I'd like to achieve. The main question I pose is how to store the previous date and only begin a new column when the date has changed? I am hacking away at the llama and the camel, man even the dummies book but I need this report automated very soon.
Oct 2,Oct 4
14:56:09 172.16.31.76,13:33:38 172.16.34.200
14:56:11 172.16.31.74,14:08:36 172.16.32.198
Thanks for any feedback at all. Even flames