Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
22
Task/Nested-templated-data/Jq/nested-templated-data-1.jq
Normal file
22
Task/Nested-templated-data/Jq/nested-templated-data-1.jq
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
function template {
|
||||
cat<<EOF
|
||||
[
|
||||
[[1, 2],
|
||||
[3, 4, 1],
|
||||
5 ]]
|
||||
EOF
|
||||
}
|
||||
|
||||
function payload {
|
||||
for i in $(seq 0 6) ; do
|
||||
echo Payload#$i
|
||||
done
|
||||
}
|
||||
|
||||
# Task 1: Template instantiation
|
||||
payload | jq -Rn --argfile t <(template) '
|
||||
([inputs] | with_entries(.key |= tostring)) as $dict
|
||||
| $t
|
||||
| walk(if type == "number" then $dict[tostring] else . end)
|
||||
'
|
||||
4
Task/Nested-templated-data/Jq/nested-templated-data-2.jq
Normal file
4
Task/Nested-templated-data/Jq/nested-templated-data-2.jq
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
payload | jq -Rn --argfile t <(template) '
|
||||
([inputs] | with_entries(.key |= tostring)) as $dict
|
||||
| $dict[(($dict|keys_unsorted) - ([ $t | .. | numbers ] | unique | map(tostring) ))[]]
|
||||
'
|
||||
7
Task/Nested-templated-data/Jq/nested-templated-data-3.jq
Normal file
7
Task/Nested-templated-data/Jq/nested-templated-data-3.jq
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
payload | jq -Rrn --argfile t <(template) '
|
||||
([inputs] | with_entries(.key |= tostring)) as $dict
|
||||
| $t
|
||||
| walk(if type == "number" then $dict[tostring] else . end),
|
||||
"\nUnused payload",
|
||||
$dict[(($dict|keys_unsorted) - ([ $t | .. | numbers ] | unique | map(tostring) ))[]]
|
||||
'
|
||||
18
Task/Nested-templated-data/Jq/nested-templated-data-4.jq
Normal file
18
Task/Nested-templated-data/Jq/nested-templated-data-4.jq
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
[
|
||||
[
|
||||
[
|
||||
"Payload#1",
|
||||
"Payload#2"
|
||||
],
|
||||
[
|
||||
"Payload#3",
|
||||
"Payload#4",
|
||||
"Payload#1"
|
||||
],
|
||||
"Payload#5"
|
||||
]
|
||||
]
|
||||
|
||||
Unused payload
|
||||
Payload#0
|
||||
Payload#6
|
||||
Loading…
Add table
Add a link
Reference in a new issue