First, we need to give the script the name of the file with the minimal EDR. Then, we can code this before the foreach loop
# get minimal EDR filename from commandline
my $minEDRfile = shift;
my $MinEDRstr = `grep -A37 "EDR alpha" $f | tail -n35|awk "{print \\\$
+4+\\\$5}"`;
my @MinEDRvars = split(/\n/,$MinEDRstr);
Then, inside the loop, at the print, we add an extra column to the sprintf statement:
# Print the outputs
foreach my $i(0..$NU-1){
print F sprintf("%8.3E %12.6E %12.6E %12.6E\n",
$R,$Uvars[$i],$EDRvars[$i],
$EDRvars[$i] - $MinEDRvars[$i]
);
}
And so, we call it:
./process.pl min_EDR_filename.log |