skyler has asked for the wisdom of the Perl Monks concerning the following question:
#! perl -w use strict; use File::Copy; my $cnt; my $infile = "C:\\(directory1)\\file1.chr"; my ( $yr, $mo, $dy ) = (localtime)[5,4,3]; my $outfile = sprintf( "C:\\(Directory1)\\%04d%02d%02d.txt",$yr+1900,$ +mo+1,$dy ); my $staticdir = "C:\\(directory1)\\(directory2)\\"; open IN, "<$infile" or die "Couldn't open $infile, $!"; open OUT,">$outfile" or die "Couldn't open $outfile, $!"; $cnt++; while (<IN>) { chomp; my @fields = split /\|/; my $newfile = $fields[0]; my $path_str = $fields[20]; do { warn "Empty field 19"; next } unless $path_str; my @path = split /\\/, $path_str; my $dir = join "\\", @path[ 0, 1, 2, 3, 4, 5, 6 ]; $newfile =~ s/$/.rtf/; my $out = join ('|', @fields[0..19]) . "@@" . $staticdir . $newfil +e; print OUT "$out\n"; Print "$cnt\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking for Duplicates
by rchiav (Deacon) on Feb 25, 2004 at 17:59 UTC | |
by CountZero (Bishop) on Feb 25, 2004 at 20:56 UTC | |
by rchiav (Deacon) on Feb 25, 2004 at 21:05 UTC | |
by Anonymous Monk on Feb 25, 2004 at 19:00 UTC |