Date-time-related issues: 331, 332, 359 (#704)

* xvright

* Left/right trim on --repifs

* Fix emit-flatten when main & emit output file formats differ

* Port localtime DSL functions from C to Go

* Port localtime DSL functions from C to Go (#703)

* xvright

* Left/right trim on --repifs

* Fix emit-flatten when main & emit output file formats differ

* Port localtime DSL functions from C to Go

* Time-related issues: 331, 332, 359, 477
This commit is contained in:
John Kerl 2021-10-20 21:48:26 -04:00 committed by GitHub
parent f339387fca
commit 08fdd554f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
163 changed files with 1257 additions and 287 deletions

View file

@ -12,6 +12,8 @@
# turn *.md.in into *.md (live code samples), using mlr from the $PATH
# turn *.md into docs6/site HTML and CSS files
export TZ=""
set -euo pipefail
cd go

View file

@ -192,20 +192,21 @@ FUNCTION LIST
asserting_present asserting_string atan atan2 atanh bitcount boolean
capitalize cbrt ceil clean_whitespace collapse_whitespace cos cosh depth
dhms2fsec dhms2sec erf erfc every exp expm1 flatten float floor fmtnum fold
fsec2dhms fsec2hms get_keys get_values gmt2sec gsub haskey hexfmt hms2fsec
hms2sec hostname int invqnorm is_absent is_array is_bool is_boolean is_empty
is_empty_map is_error is_float is_int is_map is_nonempty_map is_not_array
is_not_empty is_not_map is_not_null is_null is_numeric is_present is_string
joink joinkv joinv json_parse json_stringify leafcount length localtime2sec
log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect mapsum max md5
mexp min mmul msub os pow qnorm reduce regextract regextract_or_else round
roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime
select sgn sha1 sha256 sha512 sin sinh sort splita splitax splitkv splitkvx
splitnv splitnvx sqrt ssub strftime strftime_local string strip strlen
strptime strptime_local sub substr substr0 substr1 system systime systimeint
tan tanh tolower toupper truncate typeof unflatten uptime urand urand32
urandint urandrange version ! != !=~ % & && * ** + - . .* .+ .- ./ / // < <<
<= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~
fsec2dhms fsec2hms get_keys get_values gmt2localtime gmt2sec gsub haskey
hexfmt hms2fsec hms2sec hostname int invqnorm is_absent is_array is_bool
is_boolean is_empty is_empty_map is_error is_float is_int is_map
is_nonempty_map is_not_array is_not_empty is_not_map is_not_null is_null
is_numeric is_present is_string joink joinkv joinv json_parse json_stringify
leafcount length localtime2gmt localtime2sec log log10 log1p logifit lstrip
madd mapdiff mapexcept mapselect mapsum max md5 mexp min mmul msub os pow
qnorm reduce regextract regextract_or_else round roundm rstrip sec2dhms
sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime select sgn sha1 sha256
sha512 sin sinh sort splita splitax splitkv splitkvx splitnv splitnvx sqrt
ssub strftime strftime_local string strip strlen strptime strptime_local sub
substr substr0 substr1 system systime systimeint tan tanh tolower toupper
truncate typeof unflatten uptime urand urand32 urandint urandrange version !
!= !=~ % & && * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ??
??? ^ ^^ | || ~
COMMENTS-IN-DATA FLAGS
Miller lets you put comments in your data, such as
@ -470,6 +471,8 @@ MISCELLANEOUS FLAGS
the `fmtnum` function and the `format-values` verb.
--seed {n} with `n` of the form `12345678` or `0xcafefeed`. For
`put`/`filter` `urand`, `urandint`, and `urand32`.
--tz {timezone} Specify timezone, overriding `$TZ` environment
variable (if any).
-I Process files in-place. For each file name on the
command line, output is written to a temp file in the
same directory, which is then renamed over the
@ -1886,6 +1889,7 @@ FUNCTIONS FOR FILTER/PUT
any
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for any array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: any([10,20,30], func(e) {return $index == e})
Map example: any({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
@ -1894,6 +1898,7 @@ FUNCTIONS FOR FILTER/PUT
apply
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, applies the function to each element of the array/map. For arrays, the function should take one argument, for array element; it should return a new element. For maps, it should take two arguments, for map-element key and value; it should return a new key-value pair (i.e. a single-entry map).
Examples:
Array example: apply([1,2,3,4,5], func(e) {return e ** 3}) returns [1, 8, 27, 64, 125].
Map example: apply({"a":1, "b":3, "c":5}, func(k,v) {return {toupper(k): v ** 2}}) returns {"A": 1, "B":9, "C": 25}",
@ -2017,6 +2022,7 @@ FUNCTIONS FOR FILTER/PUT
every
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for every array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: every(["a", "b", "c"], func(e) {return $[e] >= 0})
Map example: every({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
@ -2028,8 +2034,9 @@ FUNCTIONS FOR FILTER/PUT
flatten
(class=collections #args=3) Flattens multi-level maps to single-level ones. Useful for nested JSON-like structures for non-JSON file formats like CSV.
Example: flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
Example: flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Examples:
flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Two-argument version: flatten($*, ".") is the same as flatten("", ".", $*).
float
@ -2043,6 +2050,7 @@ FUNCTIONS FOR FILTER/PUT
fold
(class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument.
Examples:
Array example: fold([1,2,3,4,5], func(acc,e) {return acc + e**3}, 10000) returns 10225.
Map example: fold({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum": accv+ev**2}}, {"sum":10000}) returns 10035.
@ -2058,11 +2066,18 @@ FUNCTIONS FOR FILTER/PUT
get_values
(class=collections #args=1) Returns array of keys of map or array -- in the latter case, returns a copy of the array
gmt2localtime
(class=time #args=1) Convert from a GMT-time string to a local-time string, consulting $TZ
Example:
gmt2localtime("1999-12-31T22:00:00Z") = "2000-01-01 00:00:00" with TZ="Asia/Istanbul"
gmt2sec
(class=time #args=1) Parses GMT timestamp as integer seconds since the epoch.
Example:
gmt2sec("2001-02-03T04:05:06Z") = 981173106
gsub
(class=string #args=3) Example: '$name=gsub($name, "old", "new")' (replace all).
(class=string #args=3) '$name=gsub($name, "old", "new")' (replace all).
haskey
(class=collections #args=2) True/false if map has/hasn't key, e.g. 'haskey($*, "a")' or 'haskey(mymap, mykey)', or true/false if array index is in bounds / out of bounds. Error if 1st argument is not a map or array. Note -n..-1 alias to 1..n in Miller arrays.
@ -2144,13 +2159,15 @@ FUNCTIONS FOR FILTER/PUT
joink
(class=conversion #args=2) Makes string from map/array keys.
Example: joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
Example: joink([1,2,3], ",") = "1,2,3".
Examples:
joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
joink([1,2,3], ",") = "1,2,3".
joinkv
(class=conversion #args=3) Makes string from map/array key-value pairs.
Example: joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
Example: joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
Examples:
joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
joinv
(class=conversion #args=2) Makes string from map/array values. joinv([3,4,5], ",") = "3,4,5" joinv({"a":3,"b":4,"c":5}, ",") = "3,4,5"
@ -2167,8 +2184,15 @@ FUNCTIONS FOR FILTER/PUT
length
(class=collections #args=1) Counts number of top-level entries in array/map. Scalars have length 1.
localtime2gmt
(class=time #args=1) Convert from a local-time string to a GMT-time string, consulting $TZ
Example:
localtime2gmt("2000-01-01 00:00:00") = "1999-12-31T22:00:00Z" with TZ="Asia/Istanbul"
localtime2sec
(class=time #args=1) Parses local timestamp as integer seconds since the epoch. Consults $TZ environment variable.
Example:
localtime2sec("2001-02-03 04:05:06") = 981165906 with TZ="Asia/Istanbul"
log
(class=math #args=1) Natural (base-e) logarithm.
@ -2229,14 +2253,15 @@ FUNCTIONS FOR FILTER/PUT
reduce
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element, and return the accumulated element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is the first element for arrays, or the first element's key-value pair for maps.
Examples:
Array example: reduce([1,2,3,4,5], func(acc,e) {return acc + e**3}) returns 225.
Map example: reduce({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum_of_squares": accv + ev**2}}) returns {"sum_of_squares": 35}.
regextract
(class=string #args=2) Example: '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
(class=string #args=2) '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
regextract_or_else
(class=string #args=3) Example: '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
(class=string #args=3) '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
round
(class=math #args=1) Round to nearest integer.
@ -2251,22 +2276,35 @@ FUNCTIONS FOR FILTER/PUT
(class=time #args=1) Formats integer seconds as in sec2dhms(500000) = "5d18h53m20s"
sec2gmt
(class=time #args=1,2) Formats seconds since epoch (integer part) as GMT timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
(class=time #args=1,2) Formats seconds since epoch as GMT timestamp. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part.
Examples:
sec2gmt(1234567890) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456, 6) = "2009-02-13T23:31:30.123456Z"
sec2gmtdate
(class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is.
(class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date. Leaves non-numbers as-is.
Example:
sec2gmtdate(1440768801.7) = "2015-08-28".
sec2hms
(class=time #args=1) Formats integer seconds as in sec2hms(5000) = "01:23:20"
sec2localdate
(class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is. Consults $TZ environment variable.
(class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date. Leaves non-numbers as-is. Consults $TZ environment variable.
Example:
sec2localdate(1440768801.7) = "2015-08-28" with TZ="Asia/Istanbul"
sec2localtime
(class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
(class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp. Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
Examples:
sec2localtime(1234567890) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456, 6) = "2009-02-14 01:31:30.123456" with TZ="Asia/Istanbul"
select
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, includes each input element in the output if the function returns true. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: select([1,2,3,4,5], func(e) {return e >= 3}) returns [3, 4, 5].
Map example: select({"a":1, "b":3, "c":5}, func(k,v) {return v >= 3}) returns {"b":3, "c": 5}.
@ -2290,32 +2328,39 @@ FUNCTIONS FOR FILTER/PUT
sort
(class=higher-order-functions #args=1-2) Given a map or array as first argument and string flags or function as optional second argument, returns a sorted copy of the input. With one argument, sorts array elements naturally, and maps naturally by map keys. If the second argument is a string, it can contain any of "f" for lexical (default "n" for natural/numeric), "), "c" for case-folded lexical, and "r" for reversed/descending sort. If the second argument is a function, then for arrays it should take two arguments a and b, returning < 0, 0, or > 0 as a < b, a == b, or a > b respectively; for maps the function should take four arguments ak, av, bk, and bv, again returning < 0, 0, or > 0, using a and b's keys and values.
Examples:
Array example: sort([5,2,3,1,4], func(a,b) {return b <=> a}) returns [5,4,3,2,1].
Map example: sort({"c":2,"a":3,"b":1}, func(ak,av,bk,bv) {return bv <=> av}) returns {"a":3,"c":2,"b":1}.
splita
(class=conversion #args=2) Splits string into array with type inference.
Example: splita("3,4,5", ",") = [3,4,5]
Example:
splita("3,4,5", ",") = [3,4,5]
splitax
(class=conversion #args=2) Splits string into array without type inference.
Example: splita("3,4,5", ",") = ["3","4","5"]
Example:
splita("3,4,5", ",") = ["3","4","5"]
splitkv
(class=conversion #args=3) Splits string by separators into map with type inference.
Example: splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
Example:
splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
splitkvx
(class=conversion #args=3) Splits string by separators into map without type inference (keys and values are strings).
Example: splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
Example:
splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
splitnv
(class=conversion #args=2) Splits string by separator into integer-indexed map with type inference.
Example: splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
Example:
splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
splitnvx
(class=conversion #args=2) Splits string by separator into integer-indexed map without type inference (values are strings).
Example: splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
Example:
splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
sqrt
(class=math #args=1) Square root.
@ -2324,10 +2369,16 @@ FUNCTIONS FOR FILTER/PUT
(class=string #args=3) Like sub but does no regexing. No characters are special.
strftime
(class=time #args=2) Formats seconds since the epoch as timestamp, e.g. strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z", and strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z". Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
(class=time #args=2) Formats seconds since the epoch as timestamp. Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
Examples:
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z"
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z"
strftime_local
(class=time #args=2) Like strftime but consults the $TZ environment variable to get local time zone.
Examples:
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%S %z") = "2015-08-28 16:33:21 +0300" with TZ="Asia/Istanbul"
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%3S %z") = "2015-08-28 16:33:21.700 +0300" with TZ="Asia/Istanbul"
string
(class=conversion #args=1) Convert int/float/bool/string/array/map to string.
@ -2339,13 +2390,22 @@ FUNCTIONS FOR FILTER/PUT
(class=string #args=1) String length.
strptime
(class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch, e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000, and strptime("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000. See also strptime_local.
(class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch. See also strptime_local.
Examples:
strptime("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000
strptime("2015-08-28T13:33:21.345Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000
strptime("1970-01-01 00:00:00 -0400", "%Y-%m-%d %H:%M:%S %z") = 14400
strptime("1970-01-01 00:00:00 EET", "%Y-%m-%d %H:%M:%S %Z") = -7200
strptime_local
(class=time #args=2) Like stpftime but consults the $TZ environment variable to get local time zone.
Examples:
strptime_local("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440758001 with TZ="Asia/Istanbul"
strptime_local("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440758001.345 with TZ="Asia/Istanbul"
strptime_local("2015-08-28 13:33:21", "%Y-%m-%d %H:%M:%S") = 1440758001 with TZ="Asia/Istanbul"
sub
(class=string #args=3) Example: '$name=sub($name, "old", "new")' (replace once).
(class=string #args=3) '$name=sub($name, "old", "new")' (replace once).
substr
(class=string #args=3) substr is an alias for substr0. See also substr1. Miller is generally 1-up with all array and string indices, but, this is a backward-compatibility issue with Miller 5 and below. Arrays are new in Miller 6; the substr function is older.
@ -2385,13 +2445,15 @@ FUNCTIONS FOR FILTER/PUT
unflatten
(class=collections #args=2) Reverses flatten. Useful for nested JSON-like structures for non-JSON file formats like CSV. See also arrayify.
Example: unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
Example:
unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
uptime
(class=time #args=0) help string will go here
urand
(class=math #args=0) Floating-point numbers uniformly distributed on the unit interval.
Example:
Int-valued example: '$n=floor(20+urand()*11)'.
urand32
@ -2886,5 +2948,5 @@ SEE ALSO
2021-10-17 MILLER(1)
2021-10-21 MILLER(1)
</pre>

View file

@ -171,20 +171,21 @@ FUNCTION LIST
asserting_present asserting_string atan atan2 atanh bitcount boolean
capitalize cbrt ceil clean_whitespace collapse_whitespace cos cosh depth
dhms2fsec dhms2sec erf erfc every exp expm1 flatten float floor fmtnum fold
fsec2dhms fsec2hms get_keys get_values gmt2sec gsub haskey hexfmt hms2fsec
hms2sec hostname int invqnorm is_absent is_array is_bool is_boolean is_empty
is_empty_map is_error is_float is_int is_map is_nonempty_map is_not_array
is_not_empty is_not_map is_not_null is_null is_numeric is_present is_string
joink joinkv joinv json_parse json_stringify leafcount length localtime2sec
log log10 log1p logifit lstrip madd mapdiff mapexcept mapselect mapsum max md5
mexp min mmul msub os pow qnorm reduce regextract regextract_or_else round
roundm rstrip sec2dhms sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime
select sgn sha1 sha256 sha512 sin sinh sort splita splitax splitkv splitkvx
splitnv splitnvx sqrt ssub strftime strftime_local string strip strlen
strptime strptime_local sub substr substr0 substr1 system systime systimeint
tan tanh tolower toupper truncate typeof unflatten uptime urand urand32
urandint urandrange version ! != !=~ % & && * ** + - . .* .+ .- ./ / // < <<
<= <=> == =~ > >= >> >>> ?: ?? ??? ^ ^^ | || ~
fsec2dhms fsec2hms get_keys get_values gmt2localtime gmt2sec gsub haskey
hexfmt hms2fsec hms2sec hostname int invqnorm is_absent is_array is_bool
is_boolean is_empty is_empty_map is_error is_float is_int is_map
is_nonempty_map is_not_array is_not_empty is_not_map is_not_null is_null
is_numeric is_present is_string joink joinkv joinv json_parse json_stringify
leafcount length localtime2gmt localtime2sec log log10 log1p logifit lstrip
madd mapdiff mapexcept mapselect mapsum max md5 mexp min mmul msub os pow
qnorm reduce regextract regextract_or_else round roundm rstrip sec2dhms
sec2gmt sec2gmtdate sec2hms sec2localdate sec2localtime select sgn sha1 sha256
sha512 sin sinh sort splita splitax splitkv splitkvx splitnv splitnvx sqrt
ssub strftime strftime_local string strip strlen strptime strptime_local sub
substr substr0 substr1 system systime systimeint tan tanh tolower toupper
truncate typeof unflatten uptime urand urand32 urandint urandrange version !
!= !=~ % & && * ** + - . .* .+ .- ./ / // < << <= <=> == =~ > >= >> >>> ?: ??
??? ^ ^^ | || ~
COMMENTS-IN-DATA FLAGS
Miller lets you put comments in your data, such as
@ -449,6 +450,8 @@ MISCELLANEOUS FLAGS
the `fmtnum` function and the `format-values` verb.
--seed {n} with `n` of the form `12345678` or `0xcafefeed`. For
`put`/`filter` `urand`, `urandint`, and `urand32`.
--tz {timezone} Specify timezone, overriding `$TZ` environment
variable (if any).
-I Process files in-place. For each file name on the
command line, output is written to a temp file in the
same directory, which is then renamed over the
@ -1865,6 +1868,7 @@ FUNCTIONS FOR FILTER/PUT
any
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for any array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: any([10,20,30], func(e) {return $index == e})
Map example: any({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
@ -1873,6 +1877,7 @@ FUNCTIONS FOR FILTER/PUT
apply
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, applies the function to each element of the array/map. For arrays, the function should take one argument, for array element; it should return a new element. For maps, it should take two arguments, for map-element key and value; it should return a new key-value pair (i.e. a single-entry map).
Examples:
Array example: apply([1,2,3,4,5], func(e) {return e ** 3}) returns [1, 8, 27, 64, 125].
Map example: apply({"a":1, "b":3, "c":5}, func(k,v) {return {toupper(k): v ** 2}}) returns {"A": 1, "B":9, "C": 25}",
@ -1996,6 +2001,7 @@ FUNCTIONS FOR FILTER/PUT
every
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for every array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: every(["a", "b", "c"], func(e) {return $[e] >= 0})
Map example: every({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
@ -2007,8 +2013,9 @@ FUNCTIONS FOR FILTER/PUT
flatten
(class=collections #args=3) Flattens multi-level maps to single-level ones. Useful for nested JSON-like structures for non-JSON file formats like CSV.
Example: flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
Example: flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Examples:
flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Two-argument version: flatten($*, ".") is the same as flatten("", ".", $*).
float
@ -2022,6 +2029,7 @@ FUNCTIONS FOR FILTER/PUT
fold
(class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument.
Examples:
Array example: fold([1,2,3,4,5], func(acc,e) {return acc + e**3}, 10000) returns 10225.
Map example: fold({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum": accv+ev**2}}, {"sum":10000}) returns 10035.
@ -2037,11 +2045,18 @@ FUNCTIONS FOR FILTER/PUT
get_values
(class=collections #args=1) Returns array of keys of map or array -- in the latter case, returns a copy of the array
gmt2localtime
(class=time #args=1) Convert from a GMT-time string to a local-time string, consulting $TZ
Example:
gmt2localtime("1999-12-31T22:00:00Z") = "2000-01-01 00:00:00" with TZ="Asia/Istanbul"
gmt2sec
(class=time #args=1) Parses GMT timestamp as integer seconds since the epoch.
Example:
gmt2sec("2001-02-03T04:05:06Z") = 981173106
gsub
(class=string #args=3) Example: '$name=gsub($name, "old", "new")' (replace all).
(class=string #args=3) '$name=gsub($name, "old", "new")' (replace all).
haskey
(class=collections #args=2) True/false if map has/hasn't key, e.g. 'haskey($*, "a")' or 'haskey(mymap, mykey)', or true/false if array index is in bounds / out of bounds. Error if 1st argument is not a map or array. Note -n..-1 alias to 1..n in Miller arrays.
@ -2123,13 +2138,15 @@ FUNCTIONS FOR FILTER/PUT
joink
(class=conversion #args=2) Makes string from map/array keys.
Example: joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
Example: joink([1,2,3], ",") = "1,2,3".
Examples:
joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
joink([1,2,3], ",") = "1,2,3".
joinkv
(class=conversion #args=3) Makes string from map/array key-value pairs.
Example: joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
Example: joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
Examples:
joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
joinv
(class=conversion #args=2) Makes string from map/array values. joinv([3,4,5], ",") = "3,4,5" joinv({"a":3,"b":4,"c":5}, ",") = "3,4,5"
@ -2146,8 +2163,15 @@ FUNCTIONS FOR FILTER/PUT
length
(class=collections #args=1) Counts number of top-level entries in array/map. Scalars have length 1.
localtime2gmt
(class=time #args=1) Convert from a local-time string to a GMT-time string, consulting $TZ
Example:
localtime2gmt("2000-01-01 00:00:00") = "1999-12-31T22:00:00Z" with TZ="Asia/Istanbul"
localtime2sec
(class=time #args=1) Parses local timestamp as integer seconds since the epoch. Consults $TZ environment variable.
Example:
localtime2sec("2001-02-03 04:05:06") = 981165906 with TZ="Asia/Istanbul"
log
(class=math #args=1) Natural (base-e) logarithm.
@ -2208,14 +2232,15 @@ FUNCTIONS FOR FILTER/PUT
reduce
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element, and return the accumulated element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is the first element for arrays, or the first element's key-value pair for maps.
Examples:
Array example: reduce([1,2,3,4,5], func(acc,e) {return acc + e**3}) returns 225.
Map example: reduce({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum_of_squares": accv + ev**2}}) returns {"sum_of_squares": 35}.
regextract
(class=string #args=2) Example: '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
(class=string #args=2) '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
regextract_or_else
(class=string #args=3) Example: '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
(class=string #args=3) '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
round
(class=math #args=1) Round to nearest integer.
@ -2230,22 +2255,35 @@ FUNCTIONS FOR FILTER/PUT
(class=time #args=1) Formats integer seconds as in sec2dhms(500000) = "5d18h53m20s"
sec2gmt
(class=time #args=1,2) Formats seconds since epoch (integer part) as GMT timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
(class=time #args=1,2) Formats seconds since epoch as GMT timestamp. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part.
Examples:
sec2gmt(1234567890) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456, 6) = "2009-02-13T23:31:30.123456Z"
sec2gmtdate
(class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is.
(class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date. Leaves non-numbers as-is.
Example:
sec2gmtdate(1440768801.7) = "2015-08-28".
sec2hms
(class=time #args=1) Formats integer seconds as in sec2hms(5000) = "01:23:20"
sec2localdate
(class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is. Consults $TZ environment variable.
(class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date. Leaves non-numbers as-is. Consults $TZ environment variable.
Example:
sec2localdate(1440768801.7) = "2015-08-28" with TZ="Asia/Istanbul"
sec2localtime
(class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
(class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp. Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
Examples:
sec2localtime(1234567890) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456, 6) = "2009-02-14 01:31:30.123456" with TZ="Asia/Istanbul"
select
(class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, includes each input element in the output if the function returns true. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: select([1,2,3,4,5], func(e) {return e >= 3}) returns [3, 4, 5].
Map example: select({"a":1, "b":3, "c":5}, func(k,v) {return v >= 3}) returns {"b":3, "c": 5}.
@ -2269,32 +2307,39 @@ FUNCTIONS FOR FILTER/PUT
sort
(class=higher-order-functions #args=1-2) Given a map or array as first argument and string flags or function as optional second argument, returns a sorted copy of the input. With one argument, sorts array elements naturally, and maps naturally by map keys. If the second argument is a string, it can contain any of "f" for lexical (default "n" for natural/numeric), "), "c" for case-folded lexical, and "r" for reversed/descending sort. If the second argument is a function, then for arrays it should take two arguments a and b, returning < 0, 0, or > 0 as a < b, a == b, or a > b respectively; for maps the function should take four arguments ak, av, bk, and bv, again returning < 0, 0, or > 0, using a and b's keys and values.
Examples:
Array example: sort([5,2,3,1,4], func(a,b) {return b <=> a}) returns [5,4,3,2,1].
Map example: sort({"c":2,"a":3,"b":1}, func(ak,av,bk,bv) {return bv <=> av}) returns {"a":3,"c":2,"b":1}.
splita
(class=conversion #args=2) Splits string into array with type inference.
Example: splita("3,4,5", ",") = [3,4,5]
Example:
splita("3,4,5", ",") = [3,4,5]
splitax
(class=conversion #args=2) Splits string into array without type inference.
Example: splita("3,4,5", ",") = ["3","4","5"]
Example:
splita("3,4,5", ",") = ["3","4","5"]
splitkv
(class=conversion #args=3) Splits string by separators into map with type inference.
Example: splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
Example:
splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
splitkvx
(class=conversion #args=3) Splits string by separators into map without type inference (keys and values are strings).
Example: splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
Example:
splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
splitnv
(class=conversion #args=2) Splits string by separator into integer-indexed map with type inference.
Example: splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
Example:
splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
splitnvx
(class=conversion #args=2) Splits string by separator into integer-indexed map without type inference (values are strings).
Example: splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
Example:
splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
sqrt
(class=math #args=1) Square root.
@ -2303,10 +2348,16 @@ FUNCTIONS FOR FILTER/PUT
(class=string #args=3) Like sub but does no regexing. No characters are special.
strftime
(class=time #args=2) Formats seconds since the epoch as timestamp, e.g. strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z", and strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z". Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
(class=time #args=2) Formats seconds since the epoch as timestamp. Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
Examples:
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z"
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z"
strftime_local
(class=time #args=2) Like strftime but consults the $TZ environment variable to get local time zone.
Examples:
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%S %z") = "2015-08-28 16:33:21 +0300" with TZ="Asia/Istanbul"
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%3S %z") = "2015-08-28 16:33:21.700 +0300" with TZ="Asia/Istanbul"
string
(class=conversion #args=1) Convert int/float/bool/string/array/map to string.
@ -2318,13 +2369,22 @@ FUNCTIONS FOR FILTER/PUT
(class=string #args=1) String length.
strptime
(class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch, e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000, and strptime("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000. See also strptime_local.
(class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch. See also strptime_local.
Examples:
strptime("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000
strptime("2015-08-28T13:33:21.345Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000
strptime("1970-01-01 00:00:00 -0400", "%Y-%m-%d %H:%M:%S %z") = 14400
strptime("1970-01-01 00:00:00 EET", "%Y-%m-%d %H:%M:%S %Z") = -7200
strptime_local
(class=time #args=2) Like stpftime but consults the $TZ environment variable to get local time zone.
Examples:
strptime_local("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440758001 with TZ="Asia/Istanbul"
strptime_local("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440758001.345 with TZ="Asia/Istanbul"
strptime_local("2015-08-28 13:33:21", "%Y-%m-%d %H:%M:%S") = 1440758001 with TZ="Asia/Istanbul"
sub
(class=string #args=3) Example: '$name=sub($name, "old", "new")' (replace once).
(class=string #args=3) '$name=sub($name, "old", "new")' (replace once).
substr
(class=string #args=3) substr is an alias for substr0. See also substr1. Miller is generally 1-up with all array and string indices, but, this is a backward-compatibility issue with Miller 5 and below. Arrays are new in Miller 6; the substr function is older.
@ -2364,13 +2424,15 @@ FUNCTIONS FOR FILTER/PUT
unflatten
(class=collections #args=2) Reverses flatten. Useful for nested JSON-like structures for non-JSON file formats like CSV. See also arrayify.
Example: unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
Example:
unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
uptime
(class=time #args=0) help string will go here
urand
(class=math #args=0) Floating-point numbers uniformly distributed on the unit interval.
Example:
Int-valued example: '$n=floor(20+urand()*11)'.
urand32
@ -2865,4 +2927,4 @@ SEE ALSO
2021-10-17 MILLER(1)
2021-10-21 MILLER(1)

View file

@ -240,7 +240,8 @@ No exact match for "split". Inexact matches:
</pre>
<pre class="pre-non-highlight-in-pair">
splita (class=conversion #args=2) Splits string into array with type inference.
Example: splita("3,4,5", ",") = [3,4,5]
Example:
splita("3,4,5", ",") = [3,4,5]
</pre>
Etc.

View file

@ -76,7 +76,7 @@ is 2. Unary operators such as `!` and `~` show argument-count of 1; the ternary
* [**Math functions**](#math-functions): [abs](#abs), [acos](#acos), [acosh](#acosh), [asin](#asin), [asinh](#asinh), [atan](#atan), [atan2](#atan2), [atanh](#atanh), [cbrt](#cbrt), [ceil](#ceil), [cos](#cos), [cosh](#cosh), [erf](#erf), [erfc](#erfc), [exp](#exp), [expm1](#expm1), [floor](#floor), [invqnorm](#invqnorm), [log](#log), [log10](#log10), [log1p](#log1p), [logifit](#logifit), [max](#max), [min](#min), [qnorm](#qnorm), [round](#round), [roundm](#roundm), [sgn](#sgn), [sin](#sin), [sinh](#sinh), [sqrt](#sqrt), [tan](#tan), [tanh](#tanh), [urand](#urand), [urand32](#urand32), [urandint](#urandint), [urandrange](#urandrange).
* [**String functions**](#string-functions): [capitalize](#capitalize), [clean_whitespace](#clean_whitespace), [collapse_whitespace](#collapse_whitespace), [gsub](#gsub), [lstrip](#lstrip), [regextract](#regextract), [regextract_or_else](#regextract_or_else), [rstrip](#rstrip), [ssub](#ssub), [strip](#strip), [strlen](#strlen), [sub](#sub), [substr](#substr), [substr0](#substr0), [substr1](#substr1), [tolower](#tolower), [toupper](#toupper), [truncate](#truncate), [\.](#dot).
* [**System functions**](#system-functions): [hostname](#hostname), [os](#os), [system](#system), [version](#version).
* [**Time functions**](#time-functions): [dhms2fsec](#dhms2fsec), [dhms2sec](#dhms2sec), [fsec2dhms](#fsec2dhms), [fsec2hms](#fsec2hms), [gmt2sec](#gmt2sec), [hms2fsec](#hms2fsec), [hms2sec](#hms2sec), [localtime2sec](#localtime2sec), [sec2dhms](#sec2dhms), [sec2gmt](#sec2gmt), [sec2gmtdate](#sec2gmtdate), [sec2hms](#sec2hms), [sec2localdate](#sec2localdate), [sec2localtime](#sec2localtime), [strftime](#strftime), [strftime_local](#strftime_local), [strptime](#strptime), [strptime_local](#strptime_local), [systime](#systime), [systimeint](#systimeint), [uptime](#uptime).
* [**Time functions**](#time-functions): [dhms2fsec](#dhms2fsec), [dhms2sec](#dhms2sec), [fsec2dhms](#fsec2dhms), [fsec2hms](#fsec2hms), [gmt2localtime](#gmt2localtime), [gmt2sec](#gmt2sec), [hms2fsec](#hms2fsec), [hms2sec](#hms2sec), [localtime2gmt](#localtime2gmt), [localtime2sec](#localtime2sec), [sec2dhms](#sec2dhms), [sec2gmt](#sec2gmt), [sec2gmtdate](#sec2gmtdate), [sec2hms](#sec2hms), [sec2localdate](#sec2localdate), [sec2localtime](#sec2localtime), [strftime](#strftime), [strftime_local](#strftime_local), [strptime](#strptime), [strptime_local](#strptime_local), [systime](#systime), [systimeint](#systimeint), [uptime](#uptime).
* [**Typing functions**](#typing-functions): [asserting_absent](#asserting_absent), [asserting_array](#asserting_array), [asserting_bool](#asserting_bool), [asserting_boolean](#asserting_boolean), [asserting_empty](#asserting_empty), [asserting_empty_map](#asserting_empty_map), [asserting_error](#asserting_error), [asserting_float](#asserting_float), [asserting_int](#asserting_int), [asserting_map](#asserting_map), [asserting_nonempty_map](#asserting_nonempty_map), [asserting_not_array](#asserting_not_array), [asserting_not_empty](#asserting_not_empty), [asserting_not_map](#asserting_not_map), [asserting_not_null](#asserting_not_null), [asserting_null](#asserting_null), [asserting_numeric](#asserting_numeric), [asserting_present](#asserting_present), [asserting_string](#asserting_string), [is_absent](#is_absent), [is_array](#is_array), [is_bool](#is_bool), [is_boolean](#is_boolean), [is_empty](#is_empty), [is_empty_map](#is_empty_map), [is_error](#is_error), [is_float](#is_float), [is_int](#is_int), [is_map](#is_map), [is_nonempty_map](#is_nonempty_map), [is_not_array](#is_not_array), [is_not_empty](#is_not_empty), [is_not_map](#is_not_map), [is_not_null](#is_not_null), [is_null](#is_null), [is_numeric](#is_numeric), [is_present](#is_present), [is_string](#is_string), [typeof](#typeof).
## Arithmetic functions
@ -381,8 +381,9 @@ depth (class=collections #args=1) Prints maximum depth of map/array. Scalars ha
### flatten
<pre class="pre-non-highlight-non-pair">
flatten (class=collections #args=3) Flattens multi-level maps to single-level ones. Useful for nested JSON-like structures for non-JSON file formats like CSV.
Example: flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
Example: flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Examples:
flatten("a", ".", {"b": { "c": 4 }}) is {"a.b.c" : 4}.
flatten("", ".", {"a": { "b": 3 }}) is {"a.b" : 3}.
Two-argument version: flatten($*, ".") is the same as flatten("", ".", $*).
</pre>
@ -456,7 +457,8 @@ mapsum (class=collections #args=variadic) With 0 args, returns empty map. With
### unflatten
<pre class="pre-non-highlight-non-pair">
unflatten (class=collections #args=2) Reverses flatten. Useful for nested JSON-like structures for non-JSON file formats like CSV. See also arrayify.
Example: unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
Example:
unflatten({"a.b.c" : 4}, ".") is {"a": "b": { "c": 4 }}.
</pre>
## Conversion functions
@ -495,16 +497,18 @@ int (class=conversion #args=1) Convert int/float/bool/string to int.
### joink
<pre class="pre-non-highlight-non-pair">
joink (class=conversion #args=2) Makes string from map/array keys.
Example: joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
Example: joink([1,2,3], ",") = "1,2,3".
Examples:
joink({"a":3,"b":4,"c":5}, ",") = "a,b,c".
joink([1,2,3], ",") = "1,2,3".
</pre>
### joinkv
<pre class="pre-non-highlight-non-pair">
joinkv (class=conversion #args=3) Makes string from map/array key-value pairs.
Example: joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
Example: joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
Examples:
joinkv([3,4,5], "=", ",") = "1=3,2=4,3=5"
joinkv({"a":3,"b":4,"c":5}, "=", ",") = "a=3,b=4,c=5"
</pre>
@ -517,42 +521,48 @@ joinv (class=conversion #args=2) Makes string from map/array values. joinv([3,
### splita
<pre class="pre-non-highlight-non-pair">
splita (class=conversion #args=2) Splits string into array with type inference.
Example: splita("3,4,5", ",") = [3,4,5]
Example:
splita("3,4,5", ",") = [3,4,5]
</pre>
### splitax
<pre class="pre-non-highlight-non-pair">
splitax (class=conversion #args=2) Splits string into array without type inference.
Example: splita("3,4,5", ",") = ["3","4","5"]
Example:
splita("3,4,5", ",") = ["3","4","5"]
</pre>
### splitkv
<pre class="pre-non-highlight-non-pair">
splitkv (class=conversion #args=3) Splits string by separators into map with type inference.
Example: splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
Example:
splitkv("a=3,b=4,c=5", "=", ",") = {"a":3,"b":4,"c":5}
</pre>
### splitkvx
<pre class="pre-non-highlight-non-pair">
splitkvx (class=conversion #args=3) Splits string by separators into map without type inference (keys and values are strings).
Example: splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
Example:
splitkvx("a=3,b=4,c=5", "=", ",") = {"a":"3","b":"4","c":"5"}
</pre>
### splitnv
<pre class="pre-non-highlight-non-pair">
splitnv (class=conversion #args=2) Splits string by separator into integer-indexed map with type inference.
Example: splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
Example:
splitnv("a,b,c", ",") = {"1":"a","2":"b","3":"c"}
</pre>
### splitnvx
<pre class="pre-non-highlight-non-pair">
splitnvx (class=conversion #args=2) Splits string by separator into integer-indexed map without type inference (values are strings).
Example: splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
Example:
splitnvx("3,4,5", ",") = {"1":"3","2":"4","3":"5"}
</pre>
@ -593,6 +603,7 @@ sha512 (class=hashing #args=1) SHA512 hash.
### any
<pre class="pre-non-highlight-non-pair">
any (class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for any array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: any([10,20,30], func(e) {return $index == e})
Map example: any({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
</pre>
@ -601,6 +612,7 @@ Map example: any({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
### apply
<pre class="pre-non-highlight-non-pair">
apply (class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, applies the function to each element of the array/map. For arrays, the function should take one argument, for array element; it should return a new element. For maps, it should take two arguments, for map-element key and value; it should return a new key-value pair (i.e. a single-entry map).
Examples:
Array example: apply([1,2,3,4,5], func(e) {return e ** 3}) returns [1, 8, 27, 64, 125].
Map example: apply({"a":1, "b":3, "c":5}, func(k,v) {return {toupper(k): v ** 2}}) returns {"A": 1, "B":9, "C": 25}",
</pre>
@ -609,6 +621,7 @@ Map example: apply({"a":1, "b":3, "c":5}, func(k,v) {return {toupper(k): v ** 2}
### every
<pre class="pre-non-highlight-non-pair">
every (class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, yields a boolean true if the argument function returns true for every array/map element, false otherwise. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: every(["a", "b", "c"], func(e) {return $[e] >= 0})
Map example: every({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
</pre>
@ -617,6 +630,7 @@ Map example: every({"a": "foo", "b": "bar"}, func(k,v) {return $[k] == v})
### fold
<pre class="pre-non-highlight-non-pair">
fold (class=higher-order-functions #args=3) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is taken from the third argument.
Examples:
Array example: fold([1,2,3,4,5], func(acc,e) {return acc + e**3}, 10000) returns 10225.
Map example: fold({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum": accv+ev**2}}, {"sum":10000}) returns 10035.
</pre>
@ -625,6 +639,7 @@ Map example: fold({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum":
### reduce
<pre class="pre-non-highlight-non-pair">
reduce (class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, accumulates entries into a final output -- for example, sum or product. For arrays, the function should take two arguments, for accumulated value and array element, and return the accumulated element. For maps, it should take four arguments, for accumulated key and value, and map-element key and value; it should return the updated accumulator as a new key-value pair (i.e. a single-entry map). The start value for the accumulator is the first element for arrays, or the first element's key-value pair for maps.
Examples:
Array example: reduce([1,2,3,4,5], func(acc,e) {return acc + e**3}) returns 225.
Map example: reduce({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum_of_squares": accv + ev**2}}) returns {"sum_of_squares": 35}.
</pre>
@ -633,6 +648,7 @@ Map example: reduce({"a":1, "b":3, "c": 5}, func(acck,accv,ek,ev) {return {"sum_
### select
<pre class="pre-non-highlight-non-pair">
select (class=higher-order-functions #args=2) Given a map or array as first argument and a function as second argument, includes each input element in the output if the function returns true. For arrays, the function should take one argument, for array element; for maps, it should take two, for map-element key and value. In either case it should return a boolean.
Examples:
Array example: select([1,2,3,4,5], func(e) {return e >= 3}) returns [3, 4, 5].
Map example: select({"a":1, "b":3, "c":5}, func(k,v) {return v >= 3}) returns {"b":3, "c": 5}.
</pre>
@ -641,6 +657,7 @@ Map example: select({"a":1, "b":3, "c":5}, func(k,v) {return v >= 3}) returns {"
### sort
<pre class="pre-non-highlight-non-pair">
sort (class=higher-order-functions #args=1-2) Given a map or array as first argument and string flags or function as optional second argument, returns a sorted copy of the input. With one argument, sorts array elements naturally, and maps naturally by map keys. If the second argument is a string, it can contain any of "f" for lexical (default "n" for natural/numeric), "), "c" for case-folded lexical, and "r" for reversed/descending sort. If the second argument is a function, then for arrays it should take two arguments a and b, returning < 0, 0, or > 0 as a < b, a == b, or a > b respectively; for maps the function should take four arguments ak, av, bk, and bv, again returning < 0, 0, or > 0, using a and b's keys and values.
Examples:
Array example: sort([5,2,3,1,4], func(a,b) {return b <=> a}) returns [5,4,3,2,1].
Map example: sort({"c":2,"a":3,"b":1}, func(ak,av,bk,bv) {return bv <=> av}) returns {"a":3,"c":2,"b":1}.
</pre>
@ -849,6 +866,7 @@ tanh (class=math #args=1) Hyperbolic tangent.
### urand
<pre class="pre-non-highlight-non-pair">
urand (class=math #args=0) Floating-point numbers uniformly distributed on the unit interval.
Example:
Int-valued example: '$n=floor(20+urand()*11)'.
</pre>
@ -893,7 +911,7 @@ collapse_whitespace (class=string #args=1) Strip repeated whitespace from strin
### gsub
<pre class="pre-non-highlight-non-pair">
gsub (class=string #args=3) Example: '$name=gsub($name, "old", "new")' (replace all).
gsub (class=string #args=3) '$name=gsub($name, "old", "new")' (replace all).
</pre>
@ -905,13 +923,13 @@ lstrip (class=string #args=1) Strip leading whitespace from string.
### regextract
<pre class="pre-non-highlight-non-pair">
regextract (class=string #args=2) Example: '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
regextract (class=string #args=2) '$name=regextract($name, "[A-Z]{3}[0-9]{2}")'
</pre>
### regextract_or_else
<pre class="pre-non-highlight-non-pair">
regextract_or_else (class=string #args=3) Example: '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
regextract_or_else (class=string #args=3) '$name=regextract_or_else($name, "[A-Z]{3}[0-9]{2}", "default")'
</pre>
@ -941,7 +959,7 @@ strlen (class=string #args=1) String length.
### sub
<pre class="pre-non-highlight-non-pair">
sub (class=string #args=3) Example: '$name=sub($name, "old", "new")' (replace once).
sub (class=string #args=3) '$name=sub($name, "old", "new")' (replace once).
</pre>
@ -1040,9 +1058,19 @@ fsec2hms (class=time #args=1) Formats floating-point seconds as in fsec2hms(500
</pre>
### gmt2localtime
<pre class="pre-non-highlight-non-pair">
gmt2localtime (class=time #args=1) Convert from a GMT-time string to a local-time string, consulting $TZ
Example:
gmt2localtime("1999-12-31T22:00:00Z") = "2000-01-01 00:00:00" with TZ="Asia/Istanbul"
</pre>
### gmt2sec
<pre class="pre-non-highlight-non-pair">
gmt2sec (class=time #args=1) Parses GMT timestamp as integer seconds since the epoch.
Example:
gmt2sec("2001-02-03T04:05:06Z") = 981173106
</pre>
@ -1058,9 +1086,19 @@ hms2sec (class=time #args=1) Recovers integer seconds as in hms2sec("01:23:20")
</pre>
### localtime2gmt
<pre class="pre-non-highlight-non-pair">
localtime2gmt (class=time #args=1) Convert from a local-time string to a GMT-time string, consulting $TZ
Example:
localtime2gmt("2000-01-01 00:00:00") = "1999-12-31T22:00:00Z" with TZ="Asia/Istanbul"
</pre>
### localtime2sec
<pre class="pre-non-highlight-non-pair">
localtime2sec (class=time #args=1) Parses local timestamp as integer seconds since the epoch. Consults $TZ environment variable.
Example:
localtime2sec("2001-02-03 04:05:06") = 981165906 with TZ="Asia/Istanbul"
</pre>
@ -1072,13 +1110,19 @@ sec2dhms (class=time #args=1) Formats integer seconds as in sec2dhms(500000) =
### sec2gmt
<pre class="pre-non-highlight-non-pair">
sec2gmt (class=time #args=1,2) Formats seconds since epoch (integer part) as GMT timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
sec2gmt (class=time #args=1,2) Formats seconds since epoch as GMT timestamp. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part.
Examples:
sec2gmt(1234567890) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456) = "2009-02-13T23:31:30Z"
sec2gmt(1234567890.123456, 6) = "2009-02-13T23:31:30.123456Z"
</pre>
### sec2gmtdate
<pre class="pre-non-highlight-non-pair">
sec2gmtdate (class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is.
sec2gmtdate (class=time #args=1) Formats seconds since epoch (integer part) as GMT timestamp with year-month-date. Leaves non-numbers as-is.
Example:
sec2gmtdate(1440768801.7) = "2015-08-28".
</pre>
@ -1090,37 +1134,58 @@ sec2hms (class=time #args=1) Formats integer seconds as in sec2hms(5000) = "01:
### sec2localdate
<pre class="pre-non-highlight-non-pair">
sec2localdate (class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date, e.g. sec2gmtdate(1440768801.7) = "2015-08-28". Leaves non-numbers as-is. Consults $TZ environment variable.
sec2localdate (class=time #args=1) Formats seconds since epoch (integer part) as local timestamp with year-month-date. Leaves non-numbers as-is. Consults $TZ environment variable.
Example:
sec2localdate(1440768801.7) = "2015-08-28" with TZ="Asia/Istanbul"
</pre>
### sec2localtime
<pre class="pre-non-highlight-non-pair">
sec2localtime (class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp, e.g. sec2gmt(1440768801.7) = "2015-08-28T13:33:21Z". Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
sec2localtime (class=time #args=1,2) Formats seconds since epoch (integer part) as local timestamp. Consults $TZ environment variable. Leaves non-numbers as-is. With second integer argument n, includes n decimal places for the seconds part
Examples:
sec2localtime(1234567890) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456) = "2009-02-14 01:31:30" with TZ="Asia/Istanbul"
sec2localtime(1234567890.123456, 6) = "2009-02-14 01:31:30.123456" with TZ="Asia/Istanbul"
</pre>
### strftime
<pre class="pre-non-highlight-non-pair">
strftime (class=time #args=2) Formats seconds since the epoch as timestamp, e.g. strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z", and strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z". Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
strftime (class=time #args=2) Formats seconds since the epoch as timestamp. Format strings are as in the C library (please see "man strftime" on your system), with the Miller-specific addition of "%1S" through "%9S" which format the seconds with 1 through 9 decimal places, respectively. ("%S" uses no decimal places.) See also strftime_local.
Examples:
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%SZ") = "2015-08-28T13:33:21Z"
strftime(1440768801.7,"%Y-%m-%dT%H:%M:%3SZ") = "2015-08-28T13:33:21.700Z"
</pre>
### strftime_local
<pre class="pre-non-highlight-non-pair">
strftime_local (class=time #args=2) Like strftime but consults the $TZ environment variable to get local time zone.
Examples:
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%S %z") = "2015-08-28 16:33:21 +0300" with TZ="Asia/Istanbul"
strftime_local(1440768801.7, "%Y-%m-%d %H:%M:%3S %z") = "2015-08-28 16:33:21.700 +0300" with TZ="Asia/Istanbul"
</pre>
### strptime
<pre class="pre-non-highlight-non-pair">
strptime (class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch, e.g. strptime("2015-08-28T13:33:21Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000, and strptime("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000. See also strptime_local.
strptime (class=time #args=2) strptime: Parses timestamp as floating-point seconds since the epoch. See also strptime_local.
Examples:
strptime("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.000000
strptime("2015-08-28T13:33:21.345Z", "%Y-%m-%dT%H:%M:%SZ") = 1440768801.345000
strptime("1970-01-01 00:00:00 -0400", "%Y-%m-%d %H:%M:%S %z") = 14400
strptime("1970-01-01 00:00:00 EET", "%Y-%m-%d %H:%M:%S %Z") = -7200
</pre>
### strptime_local
<pre class="pre-non-highlight-non-pair">
strptime_local (class=time #args=2) Like stpftime but consults the $TZ environment variable to get local time zone.
Examples:
strptime_local("2015-08-28T13:33:21Z", "%Y-%m-%dT%H:%M:%SZ") = 1440758001 with TZ="Asia/Istanbul"
strptime_local("2015-08-28T13:33:21.345Z","%Y-%m-%dT%H:%M:%SZ") = 1440758001.345 with TZ="Asia/Istanbul"
strptime_local("2015-08-28 13:33:21", "%Y-%m-%d %H:%M:%S") = 1440758001 with TZ="Asia/Istanbul"
</pre>

View file

@ -331,6 +331,8 @@ These are flags which don't fit into any other category.
`: E.g. `%.18f`, `%.0f`, `%9.6e`. Please use sprintf-style codes for floating-point nummbers. If not specified, default formatting is used. See also the `fmtnum` function and the `format-values` verb.
* `--seed {n}
`: with `n` of the form `12345678` or `0xcafefeed`. For `put`/`filter` `urand`, `urandint`, and `urand32`.
* `--tz {timezone}
`: Specify timezone, overriding `$TZ` environment variable (if any).
* `-I
`: Process files in-place. For each file name on the command line, output is written to a temp file in the same directory, which is then renamed over the original. Each file is processed in isolation: if the output format is CSV, CSV headers will be present in each output file, statistics are only over each file's own records; and so on.
* `-n

View file

@ -16,6 +16,8 @@ if [ "$do_wips" = "false" ]; then
set -euo pipefail
fi
export TZ=""
echo ================================================================
echo BUILD
go build

View file

@ -11,5 +11,5 @@ set -euo pipefail
#
# See also https://stackoverflow.com/questions/8204367/ctag-database-for-go
ctags -f gosource.tags -R `pwd`/src
ctags -f gosource.tags -R `pwd`/src `pwd`/github
mv gosource.tags tags

View file

@ -1,11 +0,0 @@
a b c d tz
2017-02-18 23:00:00 1487466000 2017-02-18T23:00:00Z 2017-02-18 America/Sao_Paulo
2017-02-18 23:59:59 1487469599 2017-02-18T23:59:59Z 2017-02-18 America/Sao_Paulo
2017-02-19 00:00:00 1487473200 2017-02-19T00:00:00Z 2017-02-19 America/Sao_Paulo
2017-02-19 00:30:00 1487475000 2017-02-19T00:30:00Z 2017-02-19 America/Sao_Paulo
2017-02-19 01:00:00 1487476800 2017-02-19T01:00:00Z 2017-02-19 America/Sao_Paulo
2017-10-14 23:00:00 1508032800 2017-10-14T23:00:00Z 2017-10-14 America/Sao_Paulo
2017-10-14 23:59:59 1508036399 2017-10-14T23:59:59Z 2017-10-14 America/Sao_Paulo
2017-10-15 00:00:00 1508032800 2017-10-14T23:00:00Z 2017-10-14 America/Sao_Paulo
2017-10-15 00:30:00 1508034600 2017-10-14T23:30:00Z 2017-10-14 America/Sao_Paulo
2017-10-15 01:00:00 1508036400 2017-10-15T01:00:00Z 2017-10-15 America/Sao_Paulo

View file

@ -1,16 +0,0 @@
a b c d tz
2017-02-14 00:00:00 1487037600 2017-02-14T00:00:00Z 2017-02-14 America/Sao_Paulo
2017-02-15 00:00:00 1487124000 2017-02-15T00:00:00Z 2017-02-15 America/Sao_Paulo
2017-02-16 00:00:00 1487210400 2017-02-16T00:00:00Z 2017-02-16 America/Sao_Paulo
2017-02-17 00:00:00 1487296800 2017-02-17T00:00:00Z 2017-02-17 America/Sao_Paulo
2017-02-18 00:00:00 1487383200 2017-02-18T00:00:00Z 2017-02-18 America/Sao_Paulo
2017-02-19 00:00:00 1487473200 2017-02-19T00:00:00Z 2017-02-19 America/Sao_Paulo
2017-02-20 00:00:00 1487559600 2017-02-20T00:00:00Z 2017-02-20 America/Sao_Paulo
2017-10-12 00:00:00 1507777200 2017-10-12T00:00:00Z 2017-10-12 America/Sao_Paulo
2017-10-13 00:00:00 1507863600 2017-10-13T00:00:00Z 2017-10-13 America/Sao_Paulo
2017-10-14 00:00:00 1507950000 2017-10-14T00:00:00Z 2017-10-14 America/Sao_Paulo
2017-10-15 00:00:00 1508032800 2017-10-14T23:00:00Z 2017-10-14 America/Sao_Paulo
2017-10-16 00:00:00 1508119200 2017-10-16T00:00:00Z 2017-10-16 America/Sao_Paulo
2017-10-17 00:00:00 1508205600 2017-10-17T00:00:00Z 2017-10-17 America/Sao_Paulo
2017-10-18 00:00:00 1508292000 2017-10-18T00:00:00Z 2017-10-18 America/Sao_Paulo
2017-10-19 00:00:00 1508378400 2017-10-19T00:00:00Z 2017-10-19 America/Sao_Paulo

View file

@ -0,0 +1,11 @@
a b c d tz
2017-02-18 23:00:00 1487466000 2017-02-18 23:00:00 2017-02-18 America/Sao_Paulo
2017-02-18 23:59:59 1487469599 2017-02-18 23:59:59 2017-02-18 America/Sao_Paulo
2017-02-19 00:00:00 1487473200 2017-02-19 00:00:00 2017-02-19 America/Sao_Paulo
2017-02-19 00:30:00 1487475000 2017-02-19 00:30:00 2017-02-19 America/Sao_Paulo
2017-02-19 01:00:00 1487476800 2017-02-19 01:00:00 2017-02-19 America/Sao_Paulo
2017-10-14 23:00:00 1508032800 2017-10-14 23:00:00 2017-10-14 America/Sao_Paulo
2017-10-14 23:59:59 1508036399 2017-10-14 23:59:59 2017-10-14 America/Sao_Paulo
2017-10-15 00:00:00 1508032800 2017-10-14 23:00:00 2017-10-14 America/Sao_Paulo
2017-10-15 00:30:00 1508034600 2017-10-14 23:30:00 2017-10-14 America/Sao_Paulo
2017-10-15 01:00:00 1508036400 2017-10-15 01:00:00 2017-10-15 America/Sao_Paulo

View file

@ -0,0 +1,16 @@
a b c d tz
2017-02-14 00:00:00 1487037600 2017-02-14 00:00:00 2017-02-14 America/Sao_Paulo
2017-02-15 00:00:00 1487124000 2017-02-15 00:00:00 2017-02-15 America/Sao_Paulo
2017-02-16 00:00:00 1487210400 2017-02-16 00:00:00 2017-02-16 America/Sao_Paulo
2017-02-17 00:00:00 1487296800 2017-02-17 00:00:00 2017-02-17 America/Sao_Paulo
2017-02-18 00:00:00 1487383200 2017-02-18 00:00:00 2017-02-18 America/Sao_Paulo
2017-02-19 00:00:00 1487473200 2017-02-19 00:00:00 2017-02-19 America/Sao_Paulo
2017-02-20 00:00:00 1487559600 2017-02-20 00:00:00 2017-02-20 America/Sao_Paulo
2017-10-12 00:00:00 1507777200 2017-10-12 00:00:00 2017-10-12 America/Sao_Paulo
2017-10-13 00:00:00 1507863600 2017-10-13 00:00:00 2017-10-13 America/Sao_Paulo
2017-10-14 00:00:00 1507950000 2017-10-14 00:00:00 2017-10-14 America/Sao_Paulo
2017-10-15 00:00:00 1508032800 2017-10-14 23:00:00 2017-10-14 America/Sao_Paulo
2017-10-16 00:00:00 1508119200 2017-10-16 00:00:00 2017-10-16 America/Sao_Paulo
2017-10-17 00:00:00 1508205600 2017-10-17 00:00:00 2017-10-17 America/Sao_Paulo
2017-10-18 00:00:00 1508292000 2017-10-18 00:00:00 2017-10-18 America/Sao_Paulo
2017-10-19 00:00:00 1508378400 2017-10-19 00:00:00 2017-10-19 America/Sao_Paulo

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/gmt2localtime-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- GMT2LOCALTIME / LOCALTIME2GMT
1970-01-01 02:00:00
1969-12-31T22:00:00Z

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/gmt2localtime-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- GMT2LOCALTIME / LOCALTIME2GMT
1969-12-31 21:00:00
1970-01-01T03:00:00Z

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/gmt2localtime-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- GMT2LOCALTIME / LOCALTIME2GMT
1970-01-01 00:00:00
1970-01-01T00:00:00Z

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/gmt2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- GMT2SEC
0
0.123456

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/gmt2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- GMT2SEC
0
0.123456

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/gmt2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- GMT2SEC
0
0.123456

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/localtime2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- LOCALTIME2SEC
-7200
(error)

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/localtime2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- LOCALTIME2SEC
10800
(error)

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/localtime2sec-tz.mlr

View file

@ -0,0 +1,5 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- LOCALTIME2SEC
0
(error)

View file

@ -0,0 +1 @@
mlr --tz this-is-not-a-valid-timezone-name -n put -f regtest/input/sec2localtime-tz.mlr

View file

@ -0,0 +1 @@
mlr: unknown time zone this-is-not-a-valid-timezone-name

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/sec2gmt-tz.mlr

View file

@ -0,0 +1,8 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- SEC2GMT
1970-01-01T00:00:00Z
1970-01-01T00:00:00Z
1969-12-31T23:59:59Z
1970-01-01T00:00:00.123456Z
1969-12-31T23:59:59.876544Z

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/sec2gmt-tz.mlr

View file

@ -0,0 +1,8 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- SEC2GMT
1970-01-01T00:00:00Z
1970-01-01T00:00:00Z
1969-12-31T23:59:59Z
1970-01-01T00:00:00.123456Z
1969-12-31T23:59:59.876544Z

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/sec2gmt-tz.mlr

View file

@ -0,0 +1,8 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- SEC2GMT
1970-01-01T00:00:00Z
1970-01-01T00:00:00Z
1969-12-31T23:59:59Z
1970-01-01T00:00:00.123456Z
1969-12-31T23:59:59.876544Z

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/sec2gmtdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- SEC2GMTDATE
1970-01-01
1970-01-01
1969-12-31

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/sec2gmtdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- SEC2GMTDATE
1970-01-01
1970-01-01
1969-12-31

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/sec2gmtdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- SEC2GMTDATE
1970-01-01
1970-01-01
1969-12-31

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/sec2localdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- SEC2LOCALDATE
1970-01-01
1970-01-01
1970-01-01

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/sec2localdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- SEC2LOCALDATE
1969-12-31
1969-12-31
1969-12-31

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/sec2localdate-tz.mlr

View file

@ -0,0 +1,6 @@
---------------------------------------------------------------- TIMEZONE
TZ is UTC
---------------------------------------------------------------- SEC2LOCALDATE
1970-01-01
1970-01-01
1969-12-31

View file

@ -0,0 +1 @@
mlr --tz Asia/Istanbul -n put -f regtest/input/sec2localtime-tz.mlr

View file

@ -0,0 +1,8 @@
---------------------------------------------------------------- TIMEZONE
TZ is Asia/Istanbul
---------------------------------------------------------------- SEC2LOCALTILME
1970-01-01 02:00:00
1970-01-01 02:00:00
1970-01-01 01:59:59
1970-01-01 02:00:00.123456
1970-01-01 01:59:59.876544

View file

@ -0,0 +1 @@
mlr --tz America/Sao_Paulo -n put -f regtest/input/sec2localtime-tz.mlr

View file

@ -0,0 +1,8 @@
---------------------------------------------------------------- TIMEZONE
TZ is America/Sao_Paulo
---------------------------------------------------------------- SEC2LOCALTILME
1969-12-31 21:00:00
1969-12-31 21:00:00
1969-12-31 20:59:59
1969-12-31 21:00:00.123456
1969-12-31 20:59:59.876544

View file

@ -0,0 +1 @@
mlr --tz UTC -n put -f regtest/input/sec2localtime-tz.mlr

Some files were not shown because too many files have changed in this diff Show more