Hello all,
I have a script I am working on that looks to me like it should be working but it does not. It takes 4 variables from the command line, opens up a config file and compares the command line args against the config file:
Here is the config file:
When I input EW PRDAI085 EWSRDBUD EWDBABKUP from the command line my regex is supposed to find the entry and grab all the text after the EW PRDAI085 EWSRDBUD EWDBABKUP up to the ampersand (&) but here is what I am getting:
If I change my regex to start at the beginning of the line I get nothing.
next unless /^$prefix\s+$cpu\s+$sched_name\s+$job_name\s+(\w+)/;
Any help is appriciated.
If at first you don't succeed, don't try skydiving.
I have a script I am working on that looks to me like it should be working but it does not. It takes 4 variables from the command line, opens up a config file and compares the command line args against the config file:
Code:
use strict;
use warnings;
my $prefix = shift @ARGV;
my $cpu = shift @ARGV;
my $sched_name = shift @ARGV;
my $job_name = shift @ARGV;
chomp ($prefix,$cpu,$sched_name,$job_name);
print "$prefix $cpu $sched_name $job_name\n";
open (CFG, "/home/mt71124/scripts/maestro_inst.txt") or die ("Error opening config file: $1");
local $/ = '&';
while (<CFG>) {
next if /^\#/;
next unless /$prefix\s+$cpu\s+$sched_name\s+$job_name\s+(\w+)/;
print "$1\n";
exit;
}
close CFG;
print "Contact the application oncall for this prefix to remediate./n The workstation is $cpu the schedule is $sched_name the job is $job_name\n";
Here is the config file:
Code:
# EXAMPLE:
#
EW PRDAI080 EWSRUD These are UDB backups that will hold up the remainder of the RS batch cycle.
Please kill any executing jobs and cancel all Jobs in the Job Stream in reverse order due to dependencies.
Send an email to RS Systems MPelletier stating that this action was taken.&
EW PRDAI085 EWSRDBUD EWDBABKUP These are UDB backups that will hold up the remainder of the RS batch cycle.
Please kill any executing jobs and cancel all Jobs in the Job Stream in reverse order due to dependencies.
Send an email to RS Systems MPelletier stating that this action was taken.&
When I input EW PRDAI085 EWSRDBUD EWDBABKUP from the command line my regex is supposed to find the entry and grab all the text after the EW PRDAI085 EWSRDBUD EWDBABKUP up to the ampersand (&) but here is what I am getting:
Code:
# ./maestro_inst.pl EW PRDAI085 EWSRDBUD EWDBABKUP
EW PRDAI085 EWSRDBUD EWDBABKUP
These
If I change my regex to start at the beginning of the line I get nothing.
next unless /^$prefix\s+$cpu\s+$sched_name\s+$job_name\s+(\w+)/;
Any help is appriciated.
If at first you don't succeed, don't try skydiving.