Hi Experts,
Need help with the following:
Desired output:
Only want to get the output marked in green.
The file:
--- Physical volumes ---
PV Name /dev/disk/disk4704
PV Status available
Total PE 6399
Free PE 1
Autoswitch On
Proactive Polling On
PV Name /dev/disk/disk4705
PV Status available
Total PE 6399
Free PE 1
Autoswitch On
Proactive Polling On
--- Physical volume groups ---
PVG Name pvgDBSST001
PV Name /dev/disk/disk4704
PV Name /dev/disk/disk4705
- The desired output should be below:
Should be taken from the
--- Physical volumes ---
portion , and not from --- Physical volume groups --- portion .
/dev/disk/disk4704
/dev/disk/disk4705
- What I am trying :
awk '/PV Name/{print $NF}' file
/dev/disk/disk4704
/dev/disk/disk4705
/dev/disk/disk4704
/dev/disk/disk4705
I am getting 4 entry , 2 from top, 2 from bottom, but I do not want the bottom 2 disk.
Thanks,
---------- Post updated at 07:47 PM ---------- Previous update was at 07:41 PM ----------
Also , how to tell awk to filter the data from first portion only , and not go for searching "PV Name" in the second portion.
How to do a mechanism to search in this portion of data:
--- Physical volumes ---
PV Name /dev/disk/disk4704
PV Status available
Total PE 6399
Free PE 1
Autoswitch On
Proactive Polling On
PV Name /dev/disk/disk4705
PV Status available
Total PE 6399
Free PE 1
Autoswitch On
Proactive Polling On
---------- Post updated at 08:09 PM ---------- Previous update was at 07:47 PM ----------
Solved:
By removing duplicates.
[CODE]awk '/PV Name/{if(A[$NF]++==0) print $NF }'
Thank you all.