If I know the name of a job I have run, how could I return only its jobID through a script.
For example, running sacct --name run.sh
returns following output, where I want to return only 50
(jobID
).
$ sacct --name run.sh
JobID JobName Partition Account AllocCPUS State ExitCode
------------ ---------- ---------- ---------- ---------- ---------- --------
50 run.sh debug alper 1 COMPLETED 0:0
50.batch batch alper 1 COMPLETED 0:0
As a solution I can run: sacct --name run.sh | head -n3 | tail -n1 | awk '{print $1}'
that returns 50
, but sometimes order of 50
and 50.batch
changes for the other jobs.