Operating System - HP-UX
1827399 Members
6105 Online
109965 Solutions
New Discussion

Fixing bdf result display layout (not hot)!

 
SOLVED
Go to solution
MAD_2
Super Advisor

Fixing bdf result display layout (not hot)!

How can I fix the way in which my bdf results display?

This is what it looks like... Notice that since one of the filesystem is larger (/data2), all the statistical information gets shuffled to the right. How can I get it all aligned again?
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
14 REPLIES 14
John Carr_2
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Hi

To do this you need to write a small script which reads each line of the bdf , extracting the column infomation then using the printf command to reformat the output to increase the column sizes.

I have had to do this in the past and I also used the expr command to divide the values of each column by 1024 thus turning the output into MB instead of blocks which made it more sensible.

If you can wait until Monday I can post the script on the forum. Unfortunatly I have no access to it until then.

John.
MAD_2
Super Advisor

Re: Fixing bdf result display layout (not hot)!

Excellent John, I don't mind waiting until Monday if you already have something. For now I problaby leave the byte information, but later on I may also decide to switch to MB output instead.

Thanks, I'll assign points when you post the script.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
harry d brown jr
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Mynor,

try this:

bdf | tr -s " " " " |
awk '{printf("%20s %10d %10d %10d %4s %20s",$1,$2,$3,$4,$5,$6,$7)}'


THE "tr -s" command has TWO spaces in first "bb" and one space in second "b".


live free or die
harry
Live Free or Die
MAD_2
Super Advisor

Re: Fixing bdf result display layout (not hot)!

Thanks for the help Harry. However, look at the output.

By the way, what is the tr -s " " " " doing?

Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
John Carr_2
Honored Contributor
Solution

Re: Fixing bdf result display layout (not hot)!

Hi

Harry forgot to put the carriage return into the code and there are only six coulmns not seven.

try this

bdf | awk '{printf("%20s %10d %10d %10d %4s %s\n",$1,$2,$3,$4,$5,$6)}'


MAD_2
Super Advisor

Re: Fixing bdf result display layout (not hot)!

Perfect, just what I was looking for, now I can change the format a little here an there, but I can work with this.

Thanks a lot.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
John Carr_2
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Hi

Harry forgot to put the carriage return into the code and there are only six coulmns not seven.

try this

bdf | awk '{printf("%20s %10d %10d %10d %4s %s\n",$1,$2,$3,$4,$5,$6)}'

John.


John Carr_2
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Hi

opps I seem to have submitted twice !!

keep your mail notification going I shall be posting the MB version for you on Monday.

John.
John Carr_2
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Hi Mynor

I changed the script a little to left justify the first column which looks better now.

cheers
John.
John Carr_2
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Mynor

just realised an easy way to adapt this script to print MB instead of kbytes.
MAD_2
Super Advisor

Re: Fixing bdf result display layout (not hot)!

Thanks John.

I think with the script given previously I am very satisfied (how it displays is shown on the top portion of the attachment), and thanks for the MB conversion.

The last format you gave me displays the results as shown in the bottom part of the attachment. Maybe if I play a little with the field justifications I can get a different result, but for now, I am very happy with the results as shown on the top portion.

Have a nice week!
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Bill Hassell
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

You might want to download the bdfmegs script:

ftp://contrib:9unsupp8@hprc.external.hp.com/sysadmin/coolscripts/

See an example of the output. bdfmegs (and bdfmegs -l) can be run by any user, bdfmegs with the -v option requires root. With -v, you can determine the block and frag size of the filesystem, the type (and version) of the filesystem, and whether it supports large files.

You'll notice that bdfmegs always lists each mountpoint on one line (never splits) so it adjusts the width of the first field automatically.


Bill Hassell, sysadmin
MAD_2
Super Advisor

Re: Fixing bdf result display layout (not hot)!

Really cool Bill! The site you sent me has a ton of good resources.

Sorry I did not reply earlier but by the time you posted your solution I had already received a solution which I've been using since then. I just started reviewing all of my postings again today to see if I had missed any good info in the past.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
H.Merijn Brand (procura
Honored Contributor

Re: Fixing bdf result display layout (not hot)!

Drop bdf and df, and switch to 'di'!

http://hpux.connect.org.uk/hppd/hpux/Sysadmin/di-3.3/

Version 3.5 (with the 3.6 patches applied) binary is available on https://www.beepz.com/personal/merijn for 11.00 and 10.20

Current version available on http://www.gentoo.com/di/ is 3.7
Enjoy, Have FUN! H.Merijn