Re: lvm & logwatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 27, 2005 at 08:44:58AM -0500, Charles R. Anderson wrote:
> On Thu, Jan 27, 2005 at 01:20:04PM +0000, Luciano Miguel Ferreira Rocha wrote:
> > On Thu, Jan 27, 2005 at 08:02:33AM -0500, Charles R. Anderson wrote:
> > >  df -h | grep -A1 '^/dev/'
> > > 
> > > It's somewhat of a hack, but it works in my case...
> > 
> > I get a line in the middle with only '--'. Not pretty...
> > df -h | grep -E '^(/dev/| )' works better for me.
> 
> No good for me.  That includes the continuation line on excluded
> devices.  (In my case, tons of loopback mounts that I don't care to
> see):
> 
> [...]
> /dev/mapper/vg02-content
>                       1.5T  140G  1.3T  10% /srv
>                       645M  645M     0 100% /srv/ftp/pub/mnt/psyche-i386-disc1
>                       636M  636M     0 100% /srv/ftp/pub/mnt/psyche-i386-disc2
> [...]

Hm.. I was trying to avoid a complicated script:
df -h | {
while read dev size used avail perc mount
do
        [ "${dev%%/dev/*}" ] && continue
        [ -z "$size" ] && read size used avail perc mount
        S="${#dev}"
        if [ $S -gt 23 ]; then
                T="\n\t\t\t"
        elif [ $S -gt 15 ]; then
                T="\t"
        elif [ $S -gt 7 ]; then
                T="\t\t"
        else
                T="\t\t\t"
        fi
        echo -e "$dev$T$size\t$used\t$avail\t$perc\t$mount"
done
}

What about:
df -h | sed -ne '/^\/dev\/[^ ]*$/N' -e '/^\/dev\//p'

Regards,
Luciano Rocha


[Index of Archives]     [Fedora Desktop]     [Fedora SELinux]     [Photo Sharing]     [Yosemite Forum]     [KDE Users]