![](/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.