Grep contents from metastat command

Hi,

after issuing metastat command I am getting output as follows

Actually these soft partitions are more than 100.

I want output as Device Name & Size.
for eg d4004 2.0 GB

Two questions:

1) is the device name the first word of the first line?
2) Your example - eg d4004 2.0 GB - should be? = eg d4004 1.0 GB

Yes the device name is the first word.Later device name's entry will be either on 8th or 9th line (depends on Extent)

Yes It's d4004 1.0

Actually I want to extract Device Name i.e dxxxx and Its corresponding size like 1.0 GB.

Thanks.

 
awk -F"[:()]" '/Soft Partition/ {d=$1;next} /Size/ {s=$3; print d" "s}' input_file
1 Like

Thanks that worked
Just changed s=$1 instead of $3 in above command' fetched output as d4003: Soft Partition Size: 4194304 blocks (2.0 GB)

I run awk on above commands output i.e awk '{print $1 $7$8}' inputfilename
Output is like d4001: (2.0GB)