Date: Wed, 17 Nov 2010 16:41:37 -0600 From: Dan Nelson <dnelson@allantgroup.com> To: Karl Vogel <vogelke+unix@pobox.com> Cc: freebsd-questions@freebsd.org Subject: Re: a question regarding proper printf(3) formating and alignment Message-ID: <20101117224137.GG57869@dan.emsphone.com> In-Reply-To: <20101117214433.9D0DBBF95@kev.msw.wpafb.af.mil> References: <20101117155006.GA88394@freebsd.org> <20101117195521.GF57869@dan.emsphone.com> <20101117214433.9D0DBBF95@kev.msw.wpafb.af.mil>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Nov 17), Karl Vogel said: > >> In the last episode (Nov 17), Alexander Best said: > > A> i've looked at a lot of utilities in the bsd src tree and most of them > A> seem to be doing something like this: > > A> Device 1M-blocks Used Avail Capacity > A> /dev/label/swapfs 10239 0 10239 0% > A> /dev/label/swap 8191 0 8191 0% > A> Total 18431 0 18431 0% > > A> i'd like to learn of ways formatting the header so that it aligns > A> properly, whether the device name is 10 chars long or 1000. > > ports/textproc/align is a nifty perl script that'll do this for just > about any type of column-based input. If you just want to fix "df" and > you know how long the longest device name is, try something like this: Bad example, since df also auto-sizes its columns :) I think /usr/bin/rs can do column auto-balancing, but every time I try to make it do what I want, I fail. -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101117224137.GG57869>