I would definitely not recommend parsing XML in bash (or any other language
that doesn't implement nested data structures), but Perl XML::LibXML has
been a handy library for implementing our custom parsing of q* XML output.
These days I would probably use Python or Ruby but I wrote our tools many
On 8/1/2019 11:24 AM, Reuti wrote:
Hi,
Am 01.08.2019 um 15:58 schrieb David Trimboli :
When I run qhost, the output is sorted alphabetically — which means "cluster10" appears
before "cluster2," and so on.
Before I go writing bash functions to manually sort this, which might lead to output
Hi
On 01/08/2019 15:59, David Trimboli wrote:
I guess XML it is. If this were PowerShell it'd be a cinch, but working in
Bash... ugh...
I'm not a PowerShell user, but I believe it is available for Linux.
This should help, unless you are prevented from installing it on your cluster
due to
Hi,
> Am 01.08.2019 um 15:58 schrieb David Trimboli :
>
> When I run qhost, the output is sorted alphabetically — which means
> "cluster10" appears before "cluster2," and so on.
>
> Before I go writing bash functions to manually sort this, which might lead to
> output side-effects, is there
Changing the names isn't an option; I inherited these names years ago
and nobody's going to want me to change them because I want to see
something in order. :)
Basically, I can run this command to see it the way I want it:
qhost | head -n 3; qhost | tail -n +4 | sort -V
but of course this
David,
Best for qhost sort would be to change your 'cluster' names to zero-padded, if
you really want that kind of sorting. Or you could create an alias like 'qhost
| sort -nk 1.8', assuming 'clusterX' is always true (the 8th character is where
you start the sort).
As Skylar says, if you want
I'm not aware of any way to change the sort order or remove columns without
other side-effects (though I do note that "qstat -f" does not have the
column), but both of these commands do have a XML output option ("-xml")
which you could use to write your own reporting utilities.
On Thu, Aug 01,