Table
----------------------------------------------
NodeName FileName PathName BackupDate
BD3101 bananaswi \breakfa 2007-03-06
ithapple st\fruit 14:02:31.000000
s.gif s\tree\
TP4223 chocolate \sweet\d 2006-02-28
caramelfu esserts\ 21:16:41.000000
dge.gif hersheys\
EO2123 tofuwith \organic\ 2007-07-16
peas.gif vegetable 13:55:06.000000
s\legumes\
---------------------------------------------------
####
-----------------------------------------------------------
####
Column Position of Table
NodeName =1->10
FileName =11->20
PathName =21->30
BackupDate =30->End of Line
####
#!/usr/bin/perl -w
use strict;
{
my $input =$ARGV[0]; #returns filename from command line
my $nodename;
my $filename;
my $pathname;
my $backupdate;
my $textline;
my $nochar ="";
my $charposition;
my $nextrecord;
chomp $input; #strip the carriage return
open (DATAFILE, "$input")|| die ("Can not open $input:!\n");
#access the file
while (my $textline=)
{
chomp $textline;
foreach my $textline {
next if ($textline =~ /($charposition = m/({0}/)!= $nochar;
else
{
$nodename = m/({0,9}/;
$filename = m/({10,19}/;
$pathname = m/({20,29}/;
$backupdate = m/({30).*/;
printf ("%s%s%s%s\n",$nodename,
$filename, $backupdate, $pathname);
}
}
close (DATAFILE);
}