#!/pw/prod/svr4/bin/perl use warnings; use strict; use Data::Dumper; # # Purpose: Remove fields from emtoc file to facilitate title compare. # # I/O: # Input: Complete Emtoc text file. # Output: Emtoc file with index info missing. # # History: # 01/23/09 - Created # my $FALSE = 0; my $TRUE = 1; my $debug = $FALSE; if ( $#ARGV < 0 ) { print "Usage: $0 [In File][Out File]\n"; exit(1); } my $emtocin = $ARGV[0]; my $emtocout = $ARGV[1] || 'cmpemtocout.txt'; # begin processing open( FDIN, $emtocin ) || die "Could not open $emtocin\n"; open( FDOUT, $emtocout ) || die "Could not open $emtocout\n"; while ( my $record = ) { print "Record is $record\n" if $debug; # # seperate fields according to the template my @fld = split("|", $record ); # # open output file and overwrite file my $outrecord = join( '|', $fld[0], $fld[3], $fld[4], $fld[5], $fld[6], $fld[7], $fld[8] ); print FDOUT "$outrecord\n"; } close FDIN; close FDOUT; print "End of $0\n";