Re: want only two field in bdf output. (229 Views)
Reply
Occasional Advisor
Mallikarjun B
Posts: 15
Registered: ‎08-19-2008
Message 1 of 4 (229 Views)

want only two field in bdf output.

Hi,
I am trining to make a script which will show me only mountpoint and %used. I tried using bdf |awk '{print $5 , $6}' but as bdf output for one mountpoint is coming in two line so i am not able to do.
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 5144576 272768 4833832 5% /
/dev/vg00/lvol1 2097152 334152 1749296 16% /stand
/dev/vg00/lvol8 12288000 5484256 6752136 45% /var
/dev/vg00/lvol7 8192000 3444072 4710880 42% /usr
/dev/vg00/lvol6 8192000 2062232 6082112 25% /tmp
/dev/vg00/lvol5 10256384 5671680 4549056 55% /opt
/dev/vg00/lvol4 10256384 1534216 8654104 15% /home
/dev/vg00/lvol9 15728640 8342293 6924807 55% /app
/dev/vg00/secure 5144576 18754 4805464 0% /.secure
/dev/vgosmapp/lvol1
35323904 10801593 22989765 32% /osmapp
Esteemed Contributor
R.O.
Posts: 390
Registered: ‎04-20-2003
Message 2 of 4 (229 Views)

Re: want only two field in bdf output.

Whit this, you will have only one line for each FS:

# bdf | awk '{if (NF==1) {line=$0;getline;sub(" *"," ");print line$0} else {print}}'

Regards,
"When you look into an abyss, the abyss also looks into you"
Occasional Advisor
Mallikarjun B
Posts: 15
Registered: ‎08-19-2008
Message 3 of 4 (229 Views)

Re: want only two field in bdf output.

Hey,
Thanks aa ton...the output is coming in one line so i can use awk now.
Acclaimed Contributor
Dennis Handly
Posts: 25,284
Registered: ‎03-06-2006
Message 4 of 4 (229 Views)

Re: want only two field in bdf output.

Or simply:
bdf | awk 'NF != 1 {print $(NF-1), $NF}'
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.