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)  edit retag close merge delete 1 answer Sort by » oldest newest most voted After posting the question I just found what I wanted. There is the openstack command that I didn't know that existed (yum install python-openstackclient in fedora) that covers what I need: status="$(openstack server show -c status --format value my-instance-name)"

more