Running LXC 2.18 and have a number of containers running with multiple IPs. I am writing a script to push the data into redis via the “lxc list -cn4scl,image.os,image.release” command. Unfortunately, the output gives a new-line break if the container is running multiple IPs. I have tried all variants of sed, awk, tr to keep the output from wrapping to a new line but have not found the magic yet.
Any pointers?
ron@LXD-QA-Server-01# lxc list -cn4scl,image.os,image.release
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
| NAME | IPV4 | STATE | CREATED AT | LAST USED AT | IMAGE OS | IMAGE RELEASE |
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
| ron-firewall | 192.168.108.1 (eth1) | RUNNING | 2017/08/20 21:39 UTC | 2017/08/21 00:40 UTC | | |
| | 172.16.11.201 (eth0) | | | | | |
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
| ron-test-server-1 | 192.168.108.11 (eth0) | RUNNING | 2017/08/21 01:28 UTC | 2017/08/21 01:30 UTC | | |
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
| ron-test-server-2 | 192.168.109.11 (eth0) | RUNNING | 2017/09/01 01:42 UTC | 2017/09/01 01:43 UTC | | |
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
| bob-firewall | 192.168.109.1 (eth1) | RUNNING | 2017/08/21 20:05 UTC | 2017/08/21 21:00 UTC | | |
| | 172.16.11.202 (eth0) | | | | | |
+--------------------+--------------------------------+---------+----------------------+----------------------+----------+---------------+
ron@LXD-QA-Server-01# lxc list -cn4scl,image.os,image.release --format=csv
ron-firewall,"192.168.108.1 (eth1)
172.16.11.201 (eth0)",RUNNING,2017/08/20 21:39 UTC,2017/08/21 00:40 UTC,,
ron-test-server-1,192.168.108.11 (eth0),RUNNING,2017/08/21 01:28 UTC,2017/08/21 01:30 UTC,,
ron-test-server-2,192.168.108.12 (eth0),RUNNING,2017/08/21 01:28 UTC,2017/08/21 01:30 UTC,,
bob-firewall,"192.168.109.1 (eth1)
172.16.11.202 (eth0)",RUNNING,2017/08/20 21:39 UTC,2017/08/21 00:40 UTC,,