#!/usr/bin/perl use strict; use warnings; # --------------------------------------------------------------- # Parse log with following format: # Status Company Name Start Date End Date # # Assumptions: Status contains no whitespace # Dates are in YYYY-MM-DD format # Company names have nothing that looks like a date # --------------------------------------------------------------- foreach my $inpfnm (@ARGV) { if (!open INPFIL, '<', $inpfnm) { print "ERROR: Cannot open input file '$inpfnm'\n"; } else { print "\n"; print "\n"; print "\n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; while (my $inpbuf = ) { chomp $inpbuf; if ($inpbuf =~ /^(\w+)\s+(.+)\s+(\d{4}\-\d{2}\-\d{2})\s+(\d{4}\-\d{2}\-\d{2})\s*$/) { my $inpsts = $1; my $inpnam = $2; my $stadat = $3; my $enddat = $4; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; print " \n"; } } close INPFIL; print "
StatusCompany NameStart DateEnd Date
$inpsts$inpnam$stadat$enddat
\n"; print "\n"; print "\n"; } } exit; __END__