#!/bin/bash

pct list | awk 'NR>1 {print $1}' | while read -r vmid; do
    output=$(lxc-info "$vmid")
    name=$(echo "$output" | grep "Name:" | awk '{print $2}')
    first_ip=$(echo "$output" | grep "IP:" | head -n 1 | awk '{print $2}')
    echo "$name $first_ip"
done
