Format output of command line clients
Is there any way to change/format the output of command line tools like nova
? I'm looking for some way of easily parsing the output in shell scripts, without having to resort to the novaclient
python library.
Specifically I'm trying to get the status field of an instance. Right now I'm doing some parsing with sed
and awk
, but it is ugly.
It would be wonderful if I could do something like (strongly based on rpm -q --queryformat
):
status=$(nova show --format="%{status}" my-instance-name)