I'm Trying to find a way to read a file from a remote machine and log it into a .csv file, for a school I do some volunteering at.
The problem is that I only need the second line. The text file its reading looks like this.
[DefDates]
CurDefs=20041006.020
LastDefs=20040930.019
The first problem I am having is getting just the second line. The second problem is it dies at "for each $client"
Any help I could get on this would be greatly appreciated.
# Get Nav Defs
use warnings;
$LOGFILE = "\\\\$client\\c\$\\Program Files\\Common Files\\Symantec Shared\\VirusDefs\\definfo.dat";
my $filename = "report.csv";
$|++;
open F, ">$filename";
my @servers = qw(
caf1
caf3
1st1
1st2
kin1
kin4
2nd1
); # just a start
foreach my $client (@servers) {
open (LOGFILE) or die("***FLAMING DEATH***");
foreach $line (<LOGFILE>) {
chomp($line);
print "$line\n";
print F "$line, $client\n";
}
}
close
The problem is that I only need the second line. The text file its reading looks like this.
[DefDates]
CurDefs=20041006.020
LastDefs=20040930.019
The first problem I am having is getting just the second line. The second problem is it dies at "for each $client"
Any help I could get on this would be greatly appreciated.
# Get Nav Defs
use warnings;
$LOGFILE = "\\\\$client\\c\$\\Program Files\\Common Files\\Symantec Shared\\VirusDefs\\definfo.dat";
my $filename = "report.csv";
$|++;
open F, ">$filename";
my @servers = qw(
caf1
caf3
1st1
1st2
kin1
kin4
2nd1
); # just a start
foreach my $client (@servers) {
open (LOGFILE) or die("***FLAMING DEATH***");
foreach $line (<LOGFILE>) {
chomp($line);
print "$line\n";
print F "$line, $client\n";
}
}
close