Subject: Re: less-wide df(1) output
To: None <tech-misc@netbsd.org (NetBSD Miscellaneous Technical Discussion\>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: tech-misc
Date: 10/06/2002 20:40:34
> > > The implementation may adjust the spacing of the header line and
> > > the individual data lines so that the information is presented in
> > > orderly columns.
> Such column alignment is only and option in the specification and though
> with the above qualification it won't make the implemenation
> non-conformant, it does strictly cause unnecessary differences with the
> strict interpretation of the specification,
The strict interpretation of the clip from the standard above is that
the implementation may adjust the spacing of the header line and the
individual data lines so that the information is presented in orderly columns.
An implementation which adjusts the spacing to present deliberately disorderly
columns is probably wrong, however.
> and it will cause unnecessary problems with other POSIX tools that only
> work with one field separator character and thus nullifies one of the
> main reasons for wanting "portable" output
A "portable" script which assumes that only one space separates the fields
is wrong, given the statement from the standard above.
A quick pass through "sed -e 's/ */ /g'" will make standard-conformant
output with alignment spaces quite easy to parse with cut(1). In fact,
since the statement refers to "spacing" and not "spaces",
"sed -e 's/[ \t][ \t]*/ /g'" is probably a more appropriate choice.