(Video materials in preparation)
divk : Divide the specified field by 1000
Usage : divk [-s] <f1> <f2> ... <file>
Version : Mon Jun 2 19:05:05 JST 2014
Divides the numeric text data passed as the argument or via
standard input by 1000 and outputs the answer.
Used when creating a report in units of 1000s.
Each field to be divided by 1000 can be specified
sequentially as the argument. The resulting value is rounded
to the nearest whole number.
If you use the "-s" option the resulting value is not rounded
and the result is output including any decimals
$ cat data
20060201 296030 6710000
20060202 1300100 3130000
20060203 309500 20100
20060204 16300 300100
20060205 41000 210000
20060206 771100 400000
Divide the second and third field by 1000
$ divk 2 3 data
20060201 296 6710
20060202 1300 3130
20060203 310 20
20060204 16 300
20060205 41 210
20060206 771 400
If you use the "-s" option the resulting value is not rounded
and the result is output including any decimals
You can use the "round" command for post-processing.
$ divk -s 2 3 data
20060201 296.030 6710.000
20060202 1300.100 3130.000
20060203 309.500 20.100
20060204 16.300 300.100
20060205 41.000 210.000
20060206 771.100 400.000
If you use the pipe to send the output from "divk" to "divk" a
second time, you can create data displayed in units of a million.
In this case, -s option is should be used to first divk to avoid
multiple rounding.
$ echo 2499500 | divk 1 | divk 1
3
$ echo 2499500 | divk -s 1 | divk 1
2