#!/usr/bin/perl -w # txtRemoval.pl --in=%in% --out=%out% use strict; use warnings; use Text::CSV; #my ( $infile, $outfile) = @ARGV; use Getopt::Long; my @ARGS; my $wholefile = @ARGS; my $csv = Text::CSV->new() or die "Can't use CSV: ".Text::CSV->error_diag(); ## options my $opt = {}; GetOptions ($opt, 'in=s', 'out=s', ); ## make sure we have the right options unless ( defined($opt->{'in'}) and defined($opt->{'out'}) ) { die "Usage: $0 --in=INFILE.TXT --out=OUTFILE.TXT\n"; } ## open file handles open INFILE, $opt->{'in'} or die "Cannot open input file: $!"; open OUTFILE, '>', $opt->{'out'} or die "Cannot open output file: $!"; #my @elements = ["L1,", "L2,", "L3,", "L4,", "L5,", "L6,", "L7,", "L8,", "L9,", "L10,", "L11,", "L12,", "L14,", "L15,", "L16,", "DETAIL,", "SPACE,", "SUMMARY,"] my @file = ; my $reg = s/[^,]*\.(\S*)//; while (my $line = ){ chomp $line; my $wholefile = $line.$_ foreach(@file); print OUTFILE $wholefile; } ## spit out entire file #print OUTFILE $wholefile; ## close file handles close OUTFILE;