On HP-UX there are two versions of "df". One is called "df" the other is called "bdf". I think that bdf with the appropriate flags will always give output onto a single line; therefore eliminating the need to use "sed". I would think a solution that results in a single output line without needing sed would be preferred. (faster running, cleaner code)
I don't have an HP-UX box handy to test bdf on right now; I'm stating this information from memory.
Linux boxes using the GNU df command always output a single line when used with the "-P" option. Sed is not needed on Linux.
Neil G. Brookins
From: Deiss, Mark [mailto:Mark.Deiss at acs-inc.com] Sent: Wednesday, October 05, 2005 7:03 AM To: 'hobbit at hswn.dk' Subject: [hobbit] Minor tweak for the HP-UX client, possibly others for df output
Some sites that have 'df" filesystem listings that span multiple lines may need to consolidate each filesystem listing onto a single line. Noticed that the Hobbit rrd entries for our HPs have some "interesting" results ...
Just add the sed filter listed below to clean up the lines. Multiple lines can occur on HP-UX servers that have long volume group names, think it may also happen on some versions of Linux boxes, AIX boxes. Filter below is what is incorporated in BB.
in hobbitclient-hpux.sh file:
Before -
echo "[df]" /usr/bin/df -Pk
After -
echo "[df]" /usr/bin/df -Pk | sed -e '/^[^ ][^ ]*$/{ N s/[ ]*\n[ ]*/ / }'