![](/img/trans.png)
[英]Using Python to open a shell environment, run a command and exit environment
[英]Issue with the sort command in open stack server list in an ubuntu environment
只需将--sort-column Host
附加到您的openstack command
。 但是您应该确保Host
列不能有None
或null
值。
从openstack server list -h
检查:
output formatters:
output formatter options
-f {csv,json,table,value,yaml}, --format {csv,json,table,value,yaml}
the output format, defaults to table
-c COLUMN, --column COLUMN
specify the column(s) to include, can be repeated to
show multiple columns
--sort-column SORT_COLUMN
specify the column(s) to sort the data (columns
specified first have a priority, non-existing columns
are ignored), can be repeated
或者,如果您没有--sort-column
选项,您应该sort -k8
而不是-k4
。
或者使用openstack server list --all --long -c ID -c Name -c Status -c Host -f value | sort -k4
openstack server list --all --long -c ID -c Name -c Status -c Host -f value | sort -k4
仅使用-f value
,但它将用空格分隔列。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.