230 lines
6.9 KiB
HTML
230 lines
6.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of NUMFMT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>NUMFMT</H1>
|
|
Section: User Commands (1)<BR>Updated: September 2019<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
numfmt - Convert numbers from/to human-readable strings
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>numfmt</B>
|
|
|
|
[<I>,OPTION/</I>]... [<I>,NUMBER/</I>]...
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
<P>
|
|
|
|
Reformat NUMBER(s), or the numbers from standard input if none are specified.
|
|
<P>
|
|
|
|
Mandatory arguments to long options are mandatory for short options too.
|
|
<DL COMPACT>
|
|
<DT id="1"><B>--debug</B><DD>
|
|
print warnings about invalid input
|
|
<DT id="2"><B>-d</B>, <B>--delimiter</B>=<I>,X/</I><DD>
|
|
use X instead of whitespace for field delimiter
|
|
<DT id="3"><B>--field</B>=<I>,FIELDS/</I><DD>
|
|
replace the numbers in these input fields (default=1)
|
|
see FIELDS below
|
|
<DT id="4"><B>--format</B>=<I>,FORMAT/</I><DD>
|
|
use printf style floating-point FORMAT;
|
|
see FORMAT below for details
|
|
<DT id="5"><B>--from</B>=<I>,UNIT/</I><DD>
|
|
auto-scale input numbers to UNITs; default is 'none';
|
|
see UNIT below
|
|
<DT id="6"><B>--from-unit</B>=<I>,N/</I><DD>
|
|
specify the input unit size (instead of the default 1)
|
|
<DT id="7"><B>--grouping</B><DD>
|
|
use locale-defined grouping of digits, e.g. 1,000,000
|
|
(which means it has no effect in the C/POSIX locale)
|
|
<DT id="8"><B>--header</B>[=<I>,N/</I>]<DD>
|
|
print (without converting) the first N header lines;
|
|
N defaults to 1 if not specified
|
|
<DT id="9"><B>--invalid</B>=<I>,MODE/</I><DD>
|
|
failure mode for invalid numbers: MODE can be:
|
|
abort (default), fail, warn, ignore
|
|
<DT id="10"><B>--padding</B>=<I>,N/</I><DD>
|
|
pad the output to N characters; positive N will
|
|
right-align; negative N will left-align;
|
|
padding is ignored if the output is wider than N;
|
|
the default is to automatically pad if a whitespace
|
|
is found
|
|
<DT id="11"><B>--round</B>=<I>,METHOD/</I><DD>
|
|
use METHOD for rounding when scaling; METHOD can be:
|
|
up, down, from-zero (default), towards-zero, nearest
|
|
<DT id="12"><B>--suffix</B>=<I>,SUFFIX/</I><DD>
|
|
add SUFFIX to output numbers, and accept optional
|
|
SUFFIX in input numbers
|
|
<DT id="13"><B>--to</B>=<I>,UNIT/</I><DD>
|
|
auto-scale output numbers to UNITs; see UNIT below
|
|
<DT id="14"><B>--to-unit</B>=<I>,N/</I><DD>
|
|
the output unit size (instead of the default 1)
|
|
<DT id="15"><B>-z</B>, <B>--zero-terminated</B><DD>
|
|
line delimiter is NUL, not newline
|
|
<DT id="16"><B>--help</B><DD>
|
|
display this help and exit
|
|
<DT id="17"><B>--version</B><DD>
|
|
output version information and exit
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H3>UNIT options:</H3>
|
|
|
|
<DL COMPACT>
|
|
<DT id="18">none<DD>
|
|
no auto-scaling is done; suffixes will trigger an error
|
|
<DT id="19">auto<DD>
|
|
accept optional single/two letter suffix:
|
|
<DT id="20"><DD>
|
|
1K = 1000,
|
|
1Ki = 1024,
|
|
1M = 1000000,
|
|
1Mi = 1048576,
|
|
<DT id="21">si<DD>
|
|
accept optional single letter suffix:
|
|
<DT id="22"><DD>
|
|
1K = 1000,
|
|
1M = 1000000,
|
|
...
|
|
<DT id="23">iec<DD>
|
|
accept optional single letter suffix:
|
|
<DT id="24"><DD>
|
|
1K = 1024,
|
|
1M = 1048576,
|
|
...
|
|
<DT id="25">iec-i<DD>
|
|
accept optional two-letter suffix:
|
|
<DT id="26"><DD>
|
|
1Ki = 1024,
|
|
1Mi = 1048576,
|
|
...
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>FIELDS supports <A HREF="/cgi-bin/man/man2html?1+cut">cut</A>(1) style field ranges:</H3>
|
|
|
|
<DL COMPACT>
|
|
<DT id="27">N<DD>
|
|
N'th field, counted from 1
|
|
<DT id="28">N-<DD>
|
|
from N'th field, to end of line
|
|
<DT id="29">N-M<DD>
|
|
from N'th to M'th field (inclusive)
|
|
<DT id="30"><B>-M</B><DD>
|
|
from first to M'th field (inclusive)
|
|
<DT id="31">-<DD>
|
|
all fields
|
|
</DL>
|
|
<P>
|
|
|
|
Multiple fields/ranges can be separated with commas
|
|
<P>
|
|
|
|
FORMAT must be suitable for printing one floating-point argument '%f'.
|
|
Optional quote (%'f) will enable <B>--grouping</B> (if supported by current locale).
|
|
Optional width value (%10f) will pad output. Optional zero (%010f) width
|
|
will zero pad the number. Optional negative values (%-10f) will left align.
|
|
Optional precision (%.1f) will override the input determined precision.
|
|
<P>
|
|
|
|
Exit status is 0 if all input numbers were successfully converted.
|
|
By default, numfmt will stop at the first conversion error with exit status 2.
|
|
With <B>--invalid=</B>'fail' a warning is printed for each conversion error
|
|
and the exit status is 2. With <B>--invalid=</B>'warn' each conversion error is
|
|
diagnosed, but the exit status is 0. With <B>--invalid=</B>'ignore' conversion
|
|
errors are not diagnosed and the exit status is 0.
|
|
<A NAME="lbAG"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="32"><DD>
|
|
<TT>$ numfmt --to=si 1000</TT>
|
|
<DT id="33"><DD>
|
|
-> "1.0K"
|
|
<DT id="34"><DD>
|
|
<TT>$ numfmt --to=iec 2048</TT>
|
|
<DT id="35"><DD>
|
|
-> "2.0K"
|
|
<DT id="36"><DD>
|
|
<TT>$ numfmt --to=iec-i 4096</TT>
|
|
<DT id="37"><DD>
|
|
-> "4.0Ki"
|
|
<DT id="38"><DD>
|
|
<TT>$ echo 1K | numfmt --from=si</TT>
|
|
<DT id="39"><DD>
|
|
-> "1000"
|
|
<DT id="40"><DD>
|
|
<TT>$ echo 1K | numfmt --from=iec</TT>
|
|
<DT id="41"><DD>
|
|
-> "1024"
|
|
<DT id="42"><DD>
|
|
<TT>$ df -B1 | numfmt --header --field 2-4 --to=si</TT>
|
|
<BR>
|
|
|
|
<TT>$ ls -l | numfmt --header --field 5 --to=iec</TT>
|
|
<BR>
|
|
|
|
<TT>$ ls -lh | numfmt --header --field 5 --from=iec --padding=10</TT>
|
|
<BR>
|
|
|
|
<TT>$ ls -lh | numfmt --header --field 5 --from=iec --format %10f</TT>
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Written by Assaf Gordon.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>REPORTING BUGS</H2>
|
|
|
|
GNU coreutils online help: <<A HREF="https://www.gnu.org/software/coreutils/">https://www.gnu.org/software/coreutils/</A>>
|
|
<BR>
|
|
|
|
Report numfmt translation bugs to <<A HREF="https://translationproject.org/team/">https://translationproject.org/team/</A>>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>COPYRIGHT</H2>
|
|
|
|
Copyright © 2018 Free Software Foundation, Inc.
|
|
License GPLv3+: GNU GPL version 3 or later <<A HREF="https://gnu.org/licenses/gpl.html">https://gnu.org/licenses/gpl.html</A>>.
|
|
<BR>
|
|
|
|
This is free software: you are free to change and redistribute it.
|
|
There is NO WARRANTY, to the extent permitted by law.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
Full documentation at: <<A HREF="https://www.gnu.org/software/coreutils/numfmt">https://www.gnu.org/software/coreutils/numfmt</A>>
|
|
<BR>
|
|
|
|
or available locally via: info '(coreutils) numfmt invocation'
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="43"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="44"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="45"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="46"><A HREF="#lbAE">UNIT options:</A><DD>
|
|
<DT id="47"><A HREF="#lbAF">FIELDS supports cut(1) style field ranges:</A><DD>
|
|
</DL>
|
|
<DT id="48"><A HREF="#lbAG">EXAMPLES</A><DD>
|
|
<DT id="49"><A HREF="#lbAH">AUTHOR</A><DD>
|
|
<DT id="50"><A HREF="#lbAI">REPORTING BUGS</A><DD>
|
|
<DT id="51"><A HREF="#lbAJ">COPYRIGHT</A><DD>
|
|
<DT id="52"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:20 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|