Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我运行以下命令时:
我得到以下输出:
但我只想获取命令中指定的容器,而不是全部。
我怎样才能做到这一点?
您可以使用 POSIX 扩展正则表达式:
lxc list -c n '^ubuntu$' +--------+ | NAME | +--------+ | ubuntu | +--------+
如果您不希望格式化只需使用--format csv开关,它将仅输出ubuntu
--format csv
ubuntu