I'm working with a simple function that outputs some useful information about jobs I run on a cluster. It's called report:
function report()
{
for FILE in $*;
do tac $FILE | grep best -m1;
done;
}
I want to call report on the output files I generate, but only when something goes wrong and the job is terminated. The output file will have Terminated
as the last line. So, for instance:
[XXXXXX@login-0-0 scripts]$ grep Term optim_HGF.o1910512 -n
242:Terminated
[XXXXXX@login-0-0 scripts]$ report optim_HGF.o1910512
New best fit at function call 4496. Took 6.292452e+00 seconds. Objective = 4.129260e-01
Now I try to use grep to find the files for which something went wrong and pipe the names to report.
[XXXXXX@login-0-0 scripts]$ grep optim_HGF.o* -l | report
But this gives no output. How can I accomplish what I'm aiming to do?