看format命令的例子
Title
[D] format -- Set variables' output format
Syntax
Set formats
format varlist %fmt
format %fmt varlist
Set style of decimal point
set dp {comma|period} [, permanently]
Display long formats
format [varlist]
where %fmt can be a numerical, date, business calendar, or string format.
Numerical
%fmt Description Example
-------------------------------------------------------
right-justified
%#.#g general %9.0g
%#.#f fixed %9.2f
%#.#e exponential %10.7e
%21x hexadecimal %21x
%16H binary, hilo %16H
%16L binary, lohi %16L
%8H binary, hilo %8H
%8L binary, lohi %8L
right-justified with commas
%#.#gc general %9.0gc
%#.#fc fixed %9.2fc
right-justified with leading zeros
%0#.#f fixed %09.2f
left-justified
%-#.#g general %-9.0g
%-#.#f fixed %-9.2f
%-#.#e exponential %-10.7e
left-justified with commas
%-#.#gc general %-9.0gc
%-#.#fc fixed %-9.2fc
-------------------------------------------------------
You may substitute comma (,) for period (.) in any of
the above formats to make comma the decimal point. In
%9,2fc, 1000.03 is 1.000,03. Or you can set dp comma.
date
%fmt Description Example
-------------------------------------------------------
right-justified
%tc date/time %tc
%tC date/time %tC
%td date %td
%tw week %tw
%tm month %tm
%tq quarter %tq
%th half-year %th
%ty year %ty
%tg generic %tg
left-justified
%-tc date/time %-tc
%-tC date/time %-tC
%-td date %-td
etc.
-------------------------------------------------------
There are many variations allowed. See
[D] datetime display formats.
|