2022-12-05 22:42:26 +03:00
|
|
|
map(expr_to_path | path_to_expr)
|
|
|
|
[".", ".a", ".a[0]", ".a[123].bb", ".[123].a", ".[123][123].a", ".\"b b\"", ".\"a \\\\ b\"", ".\"a \\\" b\""]
|
|
|
|
[".", ".a", ".a[0]", ".a[123].bb", ".[123].a", ".[123][123].a", ".\"b b\"", ".\"a \\\\ b\"", ".\"a \\\" b\""]
|
|
|
|
|
|
|
|
.[] | group
|
|
|
|
[[1], [1,2], [1,2,2], [1,2,2,3]]
|
|
|
|
[[1]]
|
|
|
|
[[1],[2]]
|
|
|
|
[[1],[2,2]]
|
|
|
|
[[1],[2,2],[3]]
|
|
|
|
|
|
|
|
|
|
|
|
.[] | count
|
|
|
|
[[1], [1,2], [1,2,2,2], [1,2,2,2,3]]
|
|
|
|
[[1,1]]
|
|
|
|
[[1,1],[2,1]]
|
|
|
|
[[1,1],[2,3]]
|
|
|
|
[[1,1],[2,3],[3,1]]
|
|
|
|
|
|
|
|
.[] | count_by(.%2)
|
|
|
|
[[1], [1,2], [1,2,2,2], [1,2,2,2,3]]
|
|
|
|
[[1,1]]
|
|
|
|
[[0,1],[1,1]]
|
|
|
|
[[0,3],[1,1]]
|
|
|
|
[[0,3],[1,2]]
|
|
|
|
|
|
|
|
.[] | streaks
|
|
|
|
[[], [1], [1,1], [1,1,2], [1,1,2,2], [1,2,2,1]]
|
|
|
|
[]
|
|
|
|
[[1]]
|
|
|
|
[[1,1]]
|
|
|
|
[[1,1],[2]]
|
|
|
|
[[1,1],[2,2]]
|
|
|
|
[[1],[2,2],[1]]
|
|
|
|
|
|
|
|
.[] | delta
|
|
|
|
[[], [1], [1,2], [1,2,2,2], [1,2,2,2,3]]
|
|
|
|
[]
|
|
|
|
[]
|
|
|
|
[1]
|
|
|
|
[1,0,0]
|
|
|
|
[1,0,0,1]
|
|
|
|
|
|
|
|
.[] | delta_by(.a+.b)
|
|
|
|
[[], [1], [1,2], [1,2,2,2], [1,2,2,2,3]]
|
|
|
|
[]
|
|
|
|
[]
|
|
|
|
[3]
|
|
|
|
[3,4,4]
|
|
|
|
[3,4,4,5]
|
|
|
|
|
|
|
|
streaks_by(.a)
|
|
|
|
[{"a":1},{"a":1},{"a":2}]
|
|
|
|
[[{"a":1},{"a":1}],[{"a":2}]]
|
|
|
|
|
|
|
|
.[] as [$input, $size] | $input | chunk($size)
|
|
|
|
[[[], 1], [[], 2], [[1], 1], [[1], 2], [[1,2], 1], [[1,2], 2], [[1,2,3,4], 2], [[1,2,3,4], 3], ["", 1], ["", 2], ["1", 1], ["1", 2], ["12", 1], ["12", 2], ["1234", 2], ["1234", 3]]
|
|
|
|
[]
|
|
|
|
[]
|
|
|
|
[[1]]
|
|
|
|
[[1]]
|
|
|
|
[[1],[2]]
|
|
|
|
[[1,2]]
|
|
|
|
[[1,2],[3,4]]
|
|
|
|
[[1,2,3],[4]]
|
|
|
|
[]
|
|
|
|
[]
|
|
|
|
["1"]
|
|
|
|
["1"]
|
|
|
|
["1","2"]
|
|
|
|
["12"]
|
|
|
|
["12","34"]
|
|
|
|
["123","4"]
|
2023-05-12 01:21:35 +03:00
|
|
|
|
|
|
|
.[] | trim
|
|
|
|
["a", " abc ", "\n\t a\nb\n"]
|
|
|
|
"a"
|
|
|
|
"abc"
|
|
|
|
"a\nb"
|