AquaTeenFryMan
MIS
Hello,
I ma currently trying to grab a column from a flat tab delimited text file. I can't seem to get the column I want out of the text file. I would appreciate any help. My perl is horrible. Here is the code I am using:
open (FILE, "$dir$log_file");
while(<FILE>){
chomp;
$sn = (split(/\t/,$_))[1];
$sn =~ s/\s+//;
$sn =~ s/^\s+$//;
if ($sn =~ /^[0-9]+$/) {
push(@list, $sn);
}
}
close(FILE);
Here is a sample of the text file. I am trying to grab the Serial Number column:
Current Site Destination Site Serial Number
xxxxx xxxxxx 002345
The code I have works if the serial number column is the second column. I believe I am just missing something small in the code I already have. Thanks for any help you can give me.
I ma currently trying to grab a column from a flat tab delimited text file. I can't seem to get the column I want out of the text file. I would appreciate any help. My perl is horrible. Here is the code I am using:
open (FILE, "$dir$log_file");
while(<FILE>){
chomp;
$sn = (split(/\t/,$_))[1];
$sn =~ s/\s+//;
$sn =~ s/^\s+$//;
if ($sn =~ /^[0-9]+$/) {
push(@list, $sn);
}
}
close(FILE);
Here is a sample of the text file. I am trying to grab the Serial Number column:
Current Site Destination Site Serial Number
xxxxx xxxxxx 002345
The code I have works if the serial number column is the second column. I believe I am just missing something small in the code I already have. Thanks for any help you can give me.