Skip to Content.
Sympa Menu

baslinux - Re: [BL] Simple File Manager

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: 3aoo-cvfd AT dea.spamcon.org
  • To: BasicLinux List <baslinux AT lists.ibiblio.org>
  • Subject: Re: [BL] Simple File Manager
  • Date: Sun, 04 Feb 2007 07:23:56 +1300

Lee Forrest wrote:
>
> I just went over the abs guide with a fine-tooth comb.
> There's a lot about formatting (col,column...) but
> nothing like _your_ approach.
>
> Sure appreciate the help and am _very_ glad to know
> how to do that kind of formatting with non-specialized
> tools.

Modifiers for `printf' Formats
------------------------------
A format specification can also include "modifiers" that can control
how much of the item's value is printed and how much space it gets.
The modifiers come between the `%' and the format-control letter.

WIDTH
-----
This is a number specifying the desired minimum width of a field.
Inserting any number between the `%' sign and the format control
character forces the field to be expanded to this width. The
default way to do this is to pad with spaces on the left. For
example,

printf "%5s" "foo"

prints ` foo'

The value of WIDTH is a minimum width, not a maximum. If the item
value requires more than WIDTH characters, it can be as wide as
necessary. Thus,

printf "%5s" "foobar"

prints `foobar'

Preceding the WIDTH with a minus sign causes the output to be
padded with spaces on the right, instead of on the left.

printf "%-5s" "foo"

prints `foo '


.PREC
-----
This is a number that specifies the precision to use when printing.
For the `e', `E', and `f' formats, this specifies the number of
digits you want printed to the right of the decimal point. For
the `g', and `G' formats, it specifies the maximum number of
significant digits. For the `d', `o', `i', `u', `x', and `X'
formats, it specifies the minimum number of digits to print.
For a string, it specifies the maximum number of characters from
the string that should be printed. Thus,

printf "%.4s" "foobar"

prints `foob'




Archive powered by MHonArc 2.6.24.

Top of Page