Solstice DiskSuite metatree

Here's a simple script that just indents the output from metastat -p output :-)

The script

metastat -p | \
awk '
   $2 == "-m" { print; tcount=NF -3 next;}
   NF == 4 && $4 ~ /^d/ {tcount++ ;}
   {
      if(tcount>0){
         printf(" "); tcount=tcount-1;
      }
      print;
   }'

Sample output

% metatree
d10 -m d11 d12 1
   d11 1 1 c1t0d0s0
   d12 1 1 c1t1d0s0
d20 -m d23 d22 1
   d22 1 1 c1t1d0s1
   d23 1 1 c1t0d0s1
d30 -m d31 d32 1
   d31 1 1 c1t0d0s3
   d32 1 1 c1t1d0s3
d40 -m d41 1
   d41 1 1 c1t0d0s4
d42 1 1 c1t1d0s4
d50 -m d51 1
   d51 1 1 c1t0d0s5
d52 1 1 c1t1d0s5
d530 -p d60 -o 33564672 -b 2097152
d535 -p d60 -o 35661856 -b 1024000
d60 -m d61 d62 1
   d61 1 1 c1t2d0s6
   d62 1 1 c1t3d0s6
d65 -p d60 -o 10208 -b 33554432
d70 -m d71 1
   d71 1 1 /dev/dsk/emcpower0a
d80 -m d81 1
   d81 1 1 /dev/dsk/emcpower3a
d85 -p d80 -o 2592 -b 52428800
d90 -m d91 1
   d91 1 1 /dev/dsk/emcpower2a
 

Download

the script is available for download here