1NUMFMT(1)                        User Commands                       NUMFMT(1)
2
3
4

NAME

6       numfmt - Convert numbers from/to human-readable strings
7

SYNOPSIS

9       numfmt [OPTION]... [NUMBER]...
10

DESCRIPTION

12       Reformat  NUMBER(s),  or  the  numbers  from standard input if none are
13       specified.
14
15       Mandatory arguments to long options are  mandatory  for  short  options
16       too.
17
18       --debug
19              print warnings about invalid input
20
21       -d, --delimiter=X
22              use X instead of whitespace for field delimiter
23
24       --field=N
25              replace the number in input field N (default is 1)
26
27       --format=FORMAT
28              use  printf  style  floating-point  FORMAT; see FORMAT below for
29              details
30
31       --from=UNIT
32              auto-scale input numbers to UNITs; default is 'none';  see  UNIT
33              below
34
35       --from-unit=N
36              specify the input unit size (instead of the default 1)
37
38       --grouping
39              use  locale-defined  grouping  of  digits, e.g. 1,000,000 (which
40              means it has no effect in the C/POSIX locale)
41
42       --header[=N]
43              print (without converting) the first N header lines; N  defaults
44              to 1 if not specified
45
46       --invalid=MODE
47              failure  mode for invalid numbers: MODE can be: abort (default),
48              fail, warn, ignore
49
50       --padding=N
51              pad the output to N characters;  positive  N  will  right-align;
52              negative  N will left-align; padding is ignored if the output is
53              wider than N; the default is to automatically pad  if  a  white‐
54              space is found
55
56       --round=METHOD
57              use  METHOD  for rounding when scaling; METHOD can be: up, down,
58              from-zero (default), towards-zero, nearest
59
60       --suffix=SUFFIX
61              add SUFFIX to output numbers,  and  accept  optional  SUFFIX  in
62              input numbers
63
64       --to=UNIT
65              auto-scale output numbers to UNITs; see UNIT below
66
67       --to-unit=N
68              the output unit size (instead of the default 1)
69
70       --help display this help and exit
71
72       --version
73              output version information and exit
74
75   UNIT options:
76       none   no auto-scaling is done; suffixes will trigger an error
77
78       auto   accept optional single/two letter suffix:
79
80              1K = 1000, 1Ki = 1024, 1M = 1000000, 1Mi = 1048576,
81
82       si     accept optional single letter suffix:
83
84              1K = 1000, 1M = 1000000, ...
85
86       iec    accept optional single letter suffix:
87
88              1K = 1024, 1M = 1048576, ...
89
90       iec-i  accept optional two-letter suffix:
91
92              1Ki = 1024, 1Mi = 1048576, ...
93
94       FORMAT  must be suitable for printing one floating-point argument '%f'.
95       Optional quote (%'f) will enable --grouping (if  supported  by  current
96       locale).   Optional  width value (%10f) will pad output. Optional nega‐
97       tive width values (%-10f) will left-pad output.
98
99       Exit status is 0 if all input numbers were successfully converted.   By
100       default,  numfmt will stop at the first conversion error with exit sta‐
101       tus 2.  With --invalid='fail' a warning is printed for each  conversion
102       error  and the exit status is 2.  With --invalid='warn' each conversion
103       error is diagnosed, but the exit status is 0.  With  --invalid='ignore'
104       conversion errors are not diagnosed and the exit status is 0.
105

EXAMPLES

107              $ numfmt --to=si 1000
108
109              -> "1.0K"
110
111              $ numfmt --to=iec 2048
112
113              -> "2.0K"
114
115              $ numfmt --to=iec-i 4096
116
117              -> "4.0Ki"
118
119              $ echo 1K | numfmt --from=si
120
121              -> "1000"
122
123              $ echo 1K | numfmt --from=iec
124
125              -> "1024"
126
127              $ df | numfmt --header --field 2 --to=si
128              $ ls -l | numfmt --header --field 5 --to=iec
129              $ ls -lh | numfmt --header --field 5 --from=iec --padding=10
130              $ ls -lh | numfmt --header --field 5 --from=iec --format %10f
131
132       GNU  coreutils  online  help:  <http://www.gnu.org/software/coreutils/>
133       Report numfmt translation bugs to <http://translationproject.org/team/>
134

AUTHOR

136       Written by Assaf Gordon.
137
139       Copyright © 2013 Free Software Foundation, Inc.   License  GPLv3+:  GNU
140       GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
141       This  is  free  software:  you  are free to change and redistribute it.
142       There is NO WARRANTY, to the extent permitted by law.
143

SEE ALSO

145       The full documentation for numfmt is maintained as  a  Texinfo  manual.
146       If  the  info  and numfmt programs are properly installed at your site,
147       the command
148
149              info coreutils 'numfmt invocation'
150
151       should give you access to the complete manual.
152
153
154
155GNU coreutils 8.22               October 2018                        NUMFMT(1)
Impressum