Here is a hack to do it. It relies on the assumption that continued lines in qstat start with a single tab char ("\t") before the content. And that there are no blanks at end-of-line. Thus, we can simply delete all “newline-tab” combos from the qstat -f
output.
This is not pretty (well, it’s pretty ugly), but it seems to work.
qstat -f | perl -e '$/=undef;$_=<>;s/\n\t//g;print $_'
[EDIT:]
If you prefer sed
over perl
, then you can do stuff like:
qstat -f | sed ':a;N;$!ba;s/\n\t//g'
Anyway, to get just the Submit_arguments (the full attribute, and only this attribute) of a single job, you may do stuff like
attrnam=Submit_arguments
qstat -f <JOBID> | perl -e '$/=undef;$_=<>;s/\n\t//g;print $_'\
|grep "^\s\+$attrnam = "|sed -e "s/^\s\+$attrnam = //"
For my job, this outputs, on a single line:
-l walltime=00:02:00 -l select=2:ncpus=2 -l place=scatter:excl -- /bin/sleep 30
YMMV.
If somebody knows a “nicer way” - or even a secret/magic trick to get “wide lines” and “full output” with qstat, let me know (-w
and -f
don’t mix).
/Bjarne
PS [EDIT]: Just in case somebody is interested, I created a script to interface to qstat. It takes care of the “\n\t”-issue, and also can give you just the value of a single named attribute for a named job.
https://sourceforge.net/p/dcoo/cluster-tools/ci/master/tree/pbs/qstat2lin
Obviously, all input/comments to improve the script is most welcome.