I want to write a one liner on Solaris 11 to check the space in each of the zpools of my systems. The output would look like this...
myzone1 rpool 83%
myzone2 rpool 49%
All the posts I've read say to use the -v switch to pass a shell variable to awk.
Everytime I try I get an error.
This code works. I get the pool and the percentage used.
for i in `zoneadm list -icv|grep running|awk '{print $2}'`; do
zlogin $i zpool list -H|awk '{print $1" "$5}';
done
I want to add the zonename to this report output. This code does not work for me!
for i in `zoneadm list -icv|grep running|awk '{print $2}'`; do
zlogin $i zpool list -H|awk -v i="$i" '{print i" "$1" "$5}';
done
Can you help me find where I am making a mistake?
awk -v myvar="$shellvar" 'END {print myvar}'
. – DopeGhoti Oct 23 '17 at 19:40