| 1 |
printf-after-help = |
| 2 |
basic anonymous string templating: |
| 3 |
|
| 4 |
prints format string at least once, repeating as long as there are remaining arguments |
| 5 |
output prints escaped literals in the format string as character literals |
| 6 |
output replaces anonymous fields with the next unused argument, formatted according to the field. |
| 7 |
|
| 8 |
Prints the , replacing escaped character sequences with character literals |
| 9 |
and substitution field sequences with passed arguments |
| 10 |
|
| 11 |
literally, with the exception of the below |
| 12 |
escaped character sequences, and the substitution sequences described further down. |
| 13 |
|
| 14 |
### ESCAPE SEQUENCES |
| 15 |
|
| 16 |
The following escape sequences, organized here in alphabetical order, |
| 17 |
will print the corresponding character literal: |
| 18 |
|
| 19 |
- \" duobla citilo |
| 20 |
|
| 21 |
- \\ malsuprenstreko |
| 22 |
|
| 23 |
- \\a alert (BEL) |
| 24 |
|
| 25 |
- \\b backspace |
| 26 |
|
| 27 |
- \\c End-of-Input |
| 28 |
|
| 29 |
- \\e eskapo |
| 30 |
|
| 31 |
- \\f paĝosalto |
| 32 |
|
| 33 |
- \\n linifino |
| 34 |
|
| 35 |
- \\r ĉaretreveno |
| 36 |
|
| 37 |
- \\t horizontala tabeligo |
| 38 |
|
| 39 |
- \\v vertikala tabeligo |
| 40 |
|
| 41 |
- \\NNN byte with value expressed in octal value NNN (1 to 3 digits) |
| 42 |
values greater than 256 will be treated |
| 43 |
|
| 44 |
- \\xHH byte with value expressed in hexadecimal value NN (1 to 2 digits) |
| 45 |
|
| 46 |
- \\uHHHH Unicode (IEC 10646) character with value expressed in hexadecimal value HHHH (4 digits) |
| 47 |
|
| 48 |
- \\uHHHH Unicode character with value expressed in hexadecimal value HHHH (8 digits) |
| 49 |
|
| 50 |
- %% a single % |
| 51 |
|
| 52 |
### ANSTATAŬIGOJ |
| 53 |
|
| 54 |
#### RESUMO PRI ANSTATAŬIGOJ |
| 55 |
|
| 56 |
Kampoj |
| 57 |
|
| 58 |
- %s: string |
| 59 |
- %b: string parsed for literals second parameter is max length |
| 60 |
|
| 61 |
- %c: char no second parameter |
| 62 |
|
| 63 |
- %i aŭ %d: 64-bita entjero |
| 64 |
- %u: 64-bita sensignuma entjero |
| 65 |
- %x aŭ %X: 64-bita sensignuma entjero deksesume |
| 66 |
- %o: 64-bita sensignuma entjero okume |
| 67 |
second parameter is min-width, integer |
| 68 |
output below that width is padded with leading zeroes |
| 69 |
|
| 70 |
- %q: ARGUMENT is printed in a format that can be reused as shell input, escaping non-printable |
| 71 |
characters with the proposed POSIX $'' syntax. |
| 72 |
|
| 73 |
- %f aŭ %F: decimal floating point value |
| 74 |
- %e aŭ %E: scientific notation floating point value |
| 75 |
- %g aŭ %G: shorter of specially interpreted decimal or SciNote floating point value. |
| 76 |
second parameter is |
| 77 |
-max places after decimal point for floating point output |
| 78 |
-max number of significant digits for scientific notation output |
| 79 |
|
| 80 |
parameterizing fields |
| 81 |
|
| 82 |
ekzemploj: |
| 83 |
|
| 84 |
printf '%4.3i' 7 |
| 85 |
|
| 86 |
It has a first parameter of 4 and a second parameter of 3 and will result in ' 007' |
| 87 |
|
| 88 |
printf '%.1s' abcde |
| 89 |
|
| 90 |
It has no first parameter and a second parameter of 1 and will result in 'a' |
| 91 |
|
| 92 |
printf '%4c' q |
| 93 |
|
| 94 |
It has a first parameter of 4 and no second parameter and will result in ' q' |
| 95 |
|
| 96 |
The first parameter of a field is the minimum width to pad the output to |
| 97 |
if the output is less than this absolute value of this width, |
| 98 |
it will be padded with leading spaces, or, if the argument is negative, |
| 99 |
with trailing spaces. the default is zero. |
| 100 |
|
| 101 |
The second parameter of a field is particular to the output field type. |
| 102 |
defaults can be found in the full substitution help below |
| 103 |
|
| 104 |
special prefixes to numeric arguments |
| 105 |
|
| 106 |
- 0: (ekz. 010) interpret argument as octal (integer output fields only) |
| 107 |
- 0x: (ekz. 0xABC) interpret argument as hex (numeric output fields only) |
| 108 |
- \': (ekz. \'a) interpret argument as a character constant |
| 109 |
|
| 110 |
#### KIEL UZI ANSTATAŬIGOJN |
| 111 |
|
| 112 |
Substitutions are used to pass additional argument(s) into the FORMAT string, to be formatted a |
| 113 |
particular way. Ekzemple |
| 114 |
|
| 115 |
printf 'the letter %X comes before the letter %X' 10 11 |
| 116 |
|
| 117 |
will print |
| 118 |
|
| 119 |
the letter A comes before the letter B |
| 120 |
|
| 121 |
because the substitution field %X means |
| 122 |
'take an integer argument and write it as a hexadecimal number' |
| 123 |
|
| 124 |
Passing more arguments than are in the format string will cause the format string to be |
| 125 |
repeated for the remaining substitutions |
| 126 |
|
| 127 |
printf 'estas %i C en %s \n' 22 Portlando 25 Bostono 27 Nov-Jorko |
| 128 |
|
| 129 |
will print |
| 130 |
|
| 131 |
estas 22 C en Portlando |
| 132 |
estas 25 C en Bostono |
| 133 |
estas 27 C in Nov-Jorko |
| 134 |
|
| 135 |
If a format string is printed but there are less arguments remaining |
| 136 |
than there are substitution fields, substitution fields without |
| 137 |
an argument will default to empty strings, or for numeric fields |
| 138 |
the value 0single character |
| 139 |
|
| 140 |
#### DISPONEBLAJ ANSTATŬIGOJ |
| 141 |
|
| 142 |
This program, like GNU coreutils printf, |
| 143 |
interprets a modified subset of the POSIX C printf spec, |
| 144 |
a quick reference to substitutions is below. |
| 145 |
|
| 146 |
#### STRING SUBSTITUTIONS |
| 147 |
|
| 148 |
All string fields have a 'max width' parameter |
| 149 |
%.3s means 'print no more than three characters of the original input' |
| 150 |
|
| 151 |
- %s: string |
| 152 |
|
| 153 |
- %b: escaped string - the string will be checked for any escaped literals from |
| 154 |
the escaped literal list above, and translate them to literal characters. |
| 155 |
e.g. \\n will be transformed into a newline character. |
| 156 |
One special rule about %b mode is that octal literals are interpreted differently |
| 157 |
In arguments passed by %b, pass octal-interpreted literals must be in the form of \\0NNN |
| 158 |
instead of \\NNN. (Although, for legacy reasons, octal literals in the form of \\NNN will |
| 159 |
still be interpreted and not throw a warning, you will have problems if you use this for a |
| 160 |
literal whose code begins with zero, as it will be viewed as in \\0NNN form.) |
| 161 |
|
| 162 |
- %q: escaped string - the string in a format that can be reused as input by most shells. |
| 163 |
Non-printable characters are escaped with the POSIX proposed ‘$''’ syntax, |
| 164 |
and shell meta-characters are quoted appropriately. |
| 165 |
This is an equivalent format to ls --quoting=shell-escape output. |
| 166 |
|
| 167 |
#### CHAR SUBSTITUTIONS |
| 168 |
|
| 169 |
The character field does not have a secondary parameter. |
| 170 |
|
| 171 |
- %c: unu skribsigno |
| 172 |
|
| 173 |
#### ENTJERAJ ANSTATAŬIGOJ |
| 174 |
|
| 175 |
All integer fields have a 'pad with zero' parameter |
| 176 |
%.4i means an integer which if it is less than 4 digits in length, |
| 177 |
is padded with leading zeros until it is 4 digits in length. |
| 178 |
|
| 179 |
- %d aŭ %i: 64-bita entjero |
| 180 |
|
| 181 |
- %u: 64-bita sensignuma entjero |
| 182 |
|
| 183 |
- %x aŭ %X: 64-bit unsigned integer printed in Hexadecimal (base 16) |
| 184 |
%X instead of %x means to use uppercase letters for 'a' through 'f' |
| 185 |
|
| 186 |
- %o: 64-bit unsigned integer printed in octal (base 8) |
| 187 |
|
| 188 |
#### GLISKOMAJ ANSTATAŬIGOJ |
| 189 |
|
| 190 |
All floating point fields have a 'max decimal places / max significant digits' parameter |
| 191 |
%.10f means a decimal floating point with 7 decimal places past 0 |
| 192 |
%.10e means a scientific notation number with 10 significant digits |
| 193 |
%.10g means the same behavior for decimal and Sci. Note, respectively, and provides the shortest |
| 194 |
of each's output. |
| 195 |
|
| 196 |
Like with GNU coreutils, the value after the decimal point is these outputs is parsed as a |
| 197 |
double first before being rendered to text. For both implementations do not expect meaningful |
| 198 |
precision past the 18th decimal place. When using a number of decimal places that is 18 or |
| 199 |
higher, you can expect variation in output between GNU coreutils printf and this printf at the |
| 200 |
18th decimal place of +/- 1 |
| 201 |
|
| 202 |
- %f: floating point value presented in decimal, truncated and displayed to 6 decimal places by |
| 203 |
default. There is not past-double behavior parity with Coreutils printf, values are not |
| 204 |
estimated or adjusted beyond input values. |
| 205 |
|
| 206 |
- %e aŭ %E: floating point value presented in scientific notation |
| 207 |
7 significant digits by default |
| 208 |
%E means use to use uppercase E for the mantissa. |
| 209 |
|
| 210 |
- %g aorŭ %G: floating point value presented in the shortest of decimal and scientific notation |
| 211 |
behaves differently from %f and %E, please see posix printf spec for full details, |
| 212 |
some examples of different behavior: |
| 213 |
Sci Note has 6 significant digits by default |
| 214 |
Trailing zeroes are removed |
| 215 |
Instead of being truncated, digit after last is rounded |
| 216 |
|
| 217 |
Like other behavior in this utility, the design choices of floating point |
| 218 |
behavior in this utility is selected to reproduce in exact |
| 219 |
the behavior of GNU coreutils' printf from an inputs and outputs standpoint. |
| 220 |
|
| 221 |
### UZI PARAMETROJN |
| 222 |
|
| 223 |
Most substitution fields can be parameterized using up to 2 numbers that can |
| 224 |
be passed to the field, between the % sign and the field letter. |
| 225 |
|
| 226 |
The 1st parameter always indicates the minimum width of output, it is useful for creating |
| 227 |
columnar output. Any output that would be less than this minimum width is padded with |
| 228 |
leading spaces |
| 229 |
The 2nd parameter is proceeded by a dot. |
| 230 |
You do not have to use parameters |
| 231 |
|
| 232 |
### SPECIALAJ FORMOJ DE ENIGO |
| 233 |
|
| 234 |
For numeric input, the following additional forms of input are accepted besides decimal: |
| 235 |
|
| 236 |
Octal (only with integer): if the argument begins with a 0 the proceeding characters |
| 237 |
will be interpreted as octal (base 8) for integer fields |
| 238 |
|
| 239 |
Hexadecimal: if the argument begins with 0x the proceeding characters will be interpreted |
| 240 |
will be interpreted as hex (base 16) for any numeric fields |
| 241 |
for float fields, hexadecimal input results in a precision |
| 242 |
limit (in converting input past the decimal point) of 10^-15 |
| 243 |
|
| 244 |
Character Constant: if the argument begins with a single quote character, the first byte |
| 245 |
of the next character will be interpreted as an 8-bit unsigned integer. If there are |
| 246 |
additional bytes, they will throw an error (unless the environment variable POSIXLY_CORRECT |
| 247 |
is set) |
| 248 |
printf-help-version = Eligi versiajn informojn |
| 249 |
printf-help-help = Eligi helpajn informojn |
| 250 |
printf-error-missing-operand = mankas argumento |
| 251 |
printf-usage = |
| 252 |
printf ARANĜO [ARGUMENTO]... |
| 253 |
printf OPCIO |
| 254 |
printf-warning-ignoring-excess-arguments = ignorante ekstrajn argumentojn, komenciĝantajn per «{ $arg }» |
| 255 |
printf-about = Montri eligaĵon laŭ specifitaj aranĝo kaj argumentoj. |