GNU bug report logs -
#6511
df output difficult to parse
Previous Next
Reported by: Valerio Pachera <sirio81 <at> gmail.com>
Date: Fri, 25 Jun 2010 16:00:04 UTC
Severity: wishlist
Found in version 8.5
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6511 in the body.
You can then email your comments to 6511 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6511
; Package
gnu coreutils
.
(Fri, 25 Jun 2010 16:00:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Valerio Pachera <sirio81 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Fri, 25 Jun 2010 16:00:05 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Package: GNU coreutils
Version: 8.5
Severity: wishlist
Description:
I'm trying to parse di output of df command to check how much free
space is left on my disks.
I need to check this by a script.
The problem is that, when the device name is long, we get a new line
in the output (see example below).
It's difficult then have data relate with the device name or mount
poiunt usign grep and awk.
Proposed Solution:
simply add an option to not wrap the output text.
File system Dim. Usati Disp. Uso% Montato su
/dev/mapper/VolGroup00-testing
9,2G 3,3G 5,5G 38% /
tmpfs 1,5G 0 1,5G 0% /lib/init/rw
udev 10M 224K 9,8M 3% /dev
tmpfs 1,5G 12K 1,5G 1% /dev/shm
/dev/mapper/VolGroup00-dati
120G 77G 38G 68% /mnt/dati
/dev/mapper/VolGroup00-opt
5,0G 963M 3,8G 21% /opt
/dev/mapper/VolGroup00-var
5,0G 974M 3,8G 21% /var
fileserver:/pubblica 1,4T 579G 722G 45% /media/pubblica
proxy:/mnt/dati/ftp 9,8G 7,3G 2,0G 79% /media/ftp
/dev/sdb1 977M 852M 125M 88% /media/VALERIO
###### trying to extract used % ######
$ df -h /dev/mapper/VolGroup00-dati | awk '{print $4}'
Usati
68%
$ df -h /dev/sdb1 | awk '{print $4}' | tr -d %
Usati
125M
Ad you can see, the colum 4 is not the same (used% in the first case,
Total space in the second).
Thank you
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6511
; Package
coreutils
.
(Fri, 25 Jun 2010 21:11:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 6511 <at> debbugs.gnu.org (full text, mbox):
Valerio Pachera wrote:
> I'm trying to parse di output of df command to check how much free
> space is left on my disks. I need to check this by a script. The
> problem is that, when the device name is long, we get a new line in
> the output (see example below). It's difficult then have data
> relate with the device name or mount poiunt usign grep and awk.
Thank you for the report. That is a nuisance!
> Proposed Solution:
> simply add an option to not wrap the output text.
Your request has been considered, found useful and a new option has
been added to df to enable this format. Please use the -P option.
That will put all of the output on one line.
$ df -Ph /dev/mapper/VolGroup00-dati | awk '{print $4}'
-P, --portability
use the POSIX output format
Please find this option already installed on your system. I am so
glad that we could so quickly add this option for you! :-)
Bob
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6511
; Package
coreutils
.
(Fri, 25 Jun 2010 21:27:02 GMT)
Full text and
rfc822 format available.
Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):
On Friday 25 June 2010, Valerio Pachera wrote:
> Package: GNU coreutils
> Version: 8.5
>
> Severity: wishlist
>
> Description:
> I'm trying to parse di output of df command to check how much free
> space is left on my disks.
> I need to check this by a script.
> The problem is that, when the device name is long, we get a new line
> in the output (see example below).
> It's difficult then have data relate with the device name or mount
> poiunt usign grep and awk.
>
> Proposed Solution:
> simply add an option to not wrap the output text.
>
> File system Dim. Usati Disp. Uso% Montato su
> /dev/mapper/VolGroup00-testing
> 9,2G 3,3G 5,5G 38% /
> tmpfs 1,5G 0 1,5G 0% /lib/init/rw
> udev 10M 224K 9,8M 3% /dev
> tmpfs 1,5G 12K 1,5G 1% /dev/shm
> /dev/mapper/VolGroup00-dati
> 120G 77G 38G 68% /mnt/dati
> /dev/mapper/VolGroup00-opt
> 5,0G 963M 3,8G 21% /opt
> /dev/mapper/VolGroup00-var
> 5,0G 974M 3,8G 21% /var
> fileserver:/pubblica 1,4T 579G 722G 45% /media/pubblica
> proxy:/mnt/dati/ftp 9,8G 7,3G 2,0G 79% /media/ftp
> /dev/sdb1 977M 852M 125M 88% /media/VALERIO
>
>
> ###### trying to extract used % ######
>
> $ df -h /dev/mapper/VolGroup00-dati | awk '{print $4}'
> Usati
>
> 68%
>
>
> $ df -h /dev/sdb1 | awk '{print $4}' | tr -d %
> Usati
> 125M
>
>
> Ad you can see, the colum 4 is not the same (used% in the first case,
> Total space in the second).
Have a look at the -P option.
--
D.
Information forwarded
to
owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org
:
bug#6511
; Package
coreutils
.
(Fri, 25 Jun 2010 21:27:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Thu, 24 Mar 2011 00:15:03 GMT)
Full text and
rfc822 format available.
Notification sent
to
Valerio Pachera <sirio81 <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 24 Mar 2011 00:15:03 GMT)
Full text and
rfc822 format available.
Message #19 received at 6511-done <at> debbugs.gnu.org (full text, mbox):
Since I've just changed df to no longer split
entries with long device names over two lines
(since it now aligns columns consistently),
I'm closing these.
cheers,
Pádraig
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 21 Apr 2011 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 14 years and 84 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.