Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 #!/usr/bin/perl
- 2
- 3 use strict;
- 4 use warnings;
- 5 use diagnostics;
- 6 use Excel::Writer::XLSX;
- 7
- 8 #open text file and get all the EDI IDs
- 9 #based on the @ARGV selected, populate the selected column in Excel
- 10 # if value is found in the initial row, populate that row instead
- 11 #
- 12 #
- 13
- 14 #Initialize Values
- 15 #
- 16 if (@ARGV == 0){
- 17 die "Please input which tool you would like to check";
- 18 }
- 19
- 20 if ($ARGV[0] eq "JP"){
- 21 &Juniper();
- 22
- 23 };
- 24 if ($ARGV[0] eq "GP"){
- 25 print "Updating GlobalProtect Column";
- 26 };
- 27 if ($ARGV[0] eq "WS"){
- 28 print "Updating Webservices Column";
- 29
- 30 };
- 31
- 32 sub Juniper {
- 33 print "Updating Spreadsheet with Juniper\n";
- 34 open(DATA, "<file.txt") || die "Couldn't open file file.txt, $!\n";
- 35 my @line = <DATA>;
- 36 foreach my $line (@line){
- 37 if($line =~ /\b\w\w\d{4}\w\b/){
- 38 print "Found ". $line ;
- 39 my $Cell_Value;
- 40 my $workbook = Excel::Writer::XLSX->new('migration.xlsx');
- 41 my $worksheet = $workbook->add_worksheet();
- 42 $worksheet->write($Cell_Value , 0 , $line );
- 43 $Cell_Value+= 1;
- 44 $workbook->close() || die "Unable to close $!";
- 45 };
- 46 }
- 47 close(DATA) || die "Couldn't close file properly\n";
- 48 print "Exiting Subroutine\n";
- 49 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement