L1,830 HORIZON PKG RELEASE
L2,
L3,PURPOSE:,00,RELEASE #,746962464,SCHEDULE TYPE:,PR,
L4,SCH QTY TYPE:,A,
L5,
L6,HORIZON START:,20140915
L7,END:,20150913
L8,GENERATION DATE:,20140915
L9,
L10,SHIP TO NAME:,,
L16,SHIP TO CODE:,US08,
L15,
DETAIL,BUYERS PART #,QUANTITY,FCST TYPE,FCST TIMING,DATE,
DETAIL,1070954,6000,PLANNING(D),DISCREET(D),20140925SMS,10,
DETAIL,1070954,10000,PLANNING(D),DISCREET(D),20140926SMS,10,
####
#!/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;
####
while (my $wholefile = ){
my $reg = s/.*?,//;
my $wholefile = $wholefile.$reg;
}
## spit out entire file
print OUTFILE $wholefile;
####
830 HORIZON PKG RELEASE
PURPOSE:,00,RELEASE #,746962464,SCHEDULE TYPE:,PR,
SCH QTY TYPE:,A,
HORIZON START:,20140915
END:,20150913
GENERATION DATE:,20140915
SHIP TO NAME:,,
SHIP TO CODE:,US08,
BUYERS PART #,QUANTITY,FCST TYPE,FCST TIMING,DATE,
1070954,6000,PLANNING(D),DISCREET(D),20140925SMS,10,
1070954,10000,PLANNING(D),DISCREET(D),20140926SMS,10,
####
#!/usr/bin/perl -w
# txtRemoval.pl --in=%in% --out=%out%
# This script removes specific text from a file for the Mars 830 Forecast
use strict;
use warnings;
use Getopt::Long;
my $opt = {};
GetOptions ($opt,
'in=s',
'out=s',
);
my $infile = $opt->{'in'};
my $outfile = $opt->{'out'};
## 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 my $in, "<", $infile or die $!;
open my $out, ">", $outfile or die $!;
while (<$in>){
s/^(?:L\d+|DETAIL|SPACE|SUMMARY),//;
print $out $_;
}
close $in;
## close file handles
close $out;