bjobs -l gives the long description of the job where CWD is split across say 3 lines. I want a command that can reliable fetch me CWD.
If you're using a recent version of LSF (9.1.2+ I believe), you can use the -o
option of bjobs
to customize the bjobs short form output to give you each job's CWD on a single line:
$ bjobs -o 'jobid exec_cwd' 5950
JOBID EXEC_CWD
5950 /home/squirrel/cwd
If you're running an older version of LSF your only real option is to parse the long form bjobs output.
The -UF
option to bjobs
will display the same output at the -l
option, but in an "unformatted" way. This will basically take all of those job events that are currently split into many lines and display each one on a single line for easier parsing.