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 $_'
If you prefer
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
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
If somebody knows a "nicer way" - or even a secret/magic trick to get "wide lines" and "full output" with qstat, let me know (
-f don't mix).
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.
Obviously, all input/comments to improve the script is most welcome.