[LXD 4.1] List Network ; Devices ; Interfaces

Hello :wave:

I work on a script that prompt the user to fill network ; interface and device names to bind a builded command like that:
lxc network attach $__NETWORK_NAME $__CONTAINER_NAME $__DEVICE_NAME $__INTERFACE_NAME
For example lxc network attach lxdbr0 mycontainer eth0 eth0

When I work like this with container for example. I return any existing container names with a command like lxc list -c n --format csv. -c option is used to return only the container name field.

My problem is when I try to do this with lxc network list because the -c option doesn’t exist for this command. Only --format is supported. Is it schedule to implement this option?

So. If someone have idea about bash command ways to get a list of existing network ; devices ; and interface. Thanks in advance

Yeah, I think we made sure that --format exists everywhere but indeed it’d be nice if the column option was too.

In this case, the easiest probably would be lxc network list --format csv | cut -d, -f1

Yes. That will be nice.
Thanks also for the cut tip. It does the job :slight_smile:

I use this command to filter for lxd network only:
lxc network list --format csv | sed '/^lxd/!d' | cut -d, -f1