(Video materials in preparation)
taground : Round, round-up or truncate
Usage : taground [--ngthrough] [+up|-down] <f1.d1> <f2.d2> .. <file>
Version : Mon Oct 2 17:42:17 JST 2017
Edition : 1
Rounds, rounds up or truncates the specified field of the file (or
standard input) to the specified number of digits and outputs the
result. If you specify the decimal places as "0" (n.0) then the
field is output as an integer. If you specify the decimal places
as "0+num" then the integer value is rounded, rounded up or
rounded down to that number of decimal places.
$ cat data
NO V1 V2 V3 V4 V5
01 0.3418 1.5283 9.0023 7.1234 1234
02 3.1242 7.1423 6.5861 2.7735 1235
03 6.8254 2.6144 4.3234 3.4231 -1234
04 7.0343 3.3312 7.8678 1.3295 -1235
The second field is rounded to an integer, the third
field is rounded to the tenths digit, the fourth field
is rounded to the hundredths digit, the fifth field
is rounded to the thousandths digit, and the sixth
field is rounded to the tens digit.
$ taground V1.0 V2.1 V3.2 V4.3 V5.01 data
NO V1 V2 V3 V4 V5
01 0 1.5 9.00 7.123 1230
02 3 7.1 6.59 2.774 1240
03 7 2.6 4.32 3.423 -1230
04 7 3.3 7.87 1.330 -1240
Same as Example 1 except values are rounded up.
$ taground +up V1.0 V2.1 V3.2 V4.3 V5.01 data
NO V1 V2 V3 V4 V5
01 1 1.6 9.01 7.124 1240
02 4 7.2 6.59 2.774 1240
03 7 2.7 4.33 3.424 -1240
04 8 3.4 7.87 1.330 -1240
Same as Example 1 except values are truncated.
$ taground -dn V1.0 V2.1 V3.2 V4.3 V5.01 data
NO V1 V2 V3 V4 V5
01 0 1.5 9.00 7.123 1230
02 3 7.1 6.58 2.773 1230
03 6 2.6 4.32 3.423 -1230
04 7 3.3 7.86 1.329 -1230
Negative numbers are rounded as positive numbers and then
a minus sign is added.