Question
The output of the "df" command in Linux may show long volume names that cause the remainder of the line to wrap to a second line.
How can I correctly process wrapped output in Monitor Solution for Linux?
[root]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      4.8G  572M  4.0G  13% /
/dev/mapper/VolGroup00-LogVol04
                       13G  5.0G  6.9G  43% /var
/dev/mapper/VolGroup00-LogVol05
                      7.6G  4.0G  3.3G  55% /opt
/dev/mapper/VolGroup00-LogVol12
                      9.7G  2.7G  6.5G  29% /Recovery
/export/netinstall/RHEL5x-64/rhel-server-5.3-x86_64-dvd.iso
                      3.4G  3.4G     0 100% /RHEL5x_64
/export/netinstall/RHEL4x-64/RHEL4.6-x86_64-ES-DVD.iso
                      2.5G  2.5G     0 100% /RHEL4x_64
/export/netinstall/RHEL5.5x_64/rhel-server-5.5-x86_64-dvd.iso
                      3.5G  3.5G     0 100% /RHEL5.5x_64
[root]#

What Monitor Solution needs, is to have the "df" command return the results in this format:
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00                      4.8G  572M  4.0G  13% /
/dev/mapper/VolGroup00-LogVol04                       13G  5.0G  6.9G  43% /var
/dev/mapper/VolGroup00-LogVol05                      7.6G  4.0G  3.3G  55% /opt
/dev/mapper/VolGroup00-LogVol12                      9.7G  2.7G  6.5G  29% /Recovery
/export/netinstall/RHEL5x-64/rhel-server-5.3-x86_64-dvd.iso                      3.4G  3.4G     0 100% /RHEL5x_64
/export/netinstall/RHEL4x-64/RHEL4.6-x86_64-ES-DVD.iso                       2.5G  2.5G     0 100% /RHEL4x_64
/export/netinstall/RHEL5.5x_64/rhel-server-5.5-x86_64-dvd.iso                   3.5G  3.5G     0 100% /RHEL5.5x_64

Answer
We recommend using one of the following commands to get the unwrapped output from the "df" command:
df –hP
df –hP | column –t

[root]# df -hP
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00  4.8G  572M  4.0G  13% /
/dev/mapper/VolGroup00-LogVol04   13G  5.0G  6.9G  43% /var
/dev/mapper/VolGroup00-LogVol05  7.6G  4.0G  3.3G  55% /opt
/dev/mapper/VolGroup00-LogVol12  9.7G  2.7G  6.5G  29% /Recovery
/export/netinstall/RHEL5x-64/rhel-server-5.3-x86_64-dvd.iso  3.4G  3.4G     0 100% /RHEL5x_64
/export/netinstall/RHEL4x-64/RHEL4.6-x86_64-ES-DVD.iso  2.5G  2.5G     0 100% /RHEL4x_64
/export/netinstall/RHEL5.5x_64/rhel-server-5.5-x86_64-dvd.iso  3.5G  3.5G     0 100% /RHEL5.5x_64
[root]#

[root]# df -hP |column -t
Filesystem                                                                                            Size      Used     Avail    Use%  Mounted             on
/dev/mapper/VolGroup00-LogVol00                                                       4.8G     572M    4.0G     13%      /
/dev/mapper/VolGroup00-LogVol04                                                       13G      5.0G     6.9G     43%      /var
/dev/mapper/VolGroup00-LogVol05                                                       7.6G     4.0G     3.3G     55%      /opt
/export/netinstall/RHEL5x-64/rhel-server-5.3-x86_64-dvd.iso                     3.4G     3.4G     0          100%    /RHEL5x_64
/export/netinstall/RHEL4x-64/RHEL4.6-x86_64-ES-DVD.iso                     2.5G     2.5G     0          100%    /RHEL4x_64
/export/netinstall/RHEL5.5x_64/rhel-server-5.5-x86_64-dvd.iso                 3.5G     3.5G     0          100%    /RHEL5.5x_64

[root]#

No comments: