To a Man with `Jq`, Everything Looks Like JSON
1–10 of 14 posts
Re: To a Man with `Jq`, Everything Looks Like JSON
#2 $ cat some-vendor-nonsense.txt
product id: 5
price: 3.14
product id: 6
price: 6.66
$ sed "s/^/ /; s/^ product/- product/" Re: To a Man with `Jq`, Everything Looks Like JSON
#3Re: To a Man with `Jq`, Everything Looks Like JSON
#4Re: To a Man with `Jq`, Everything Looks Like JSON
#5 "\(.)"Re: To a Man with `Jq`, Everything Looks Like JSON
#6heh, wait until one discovers that gojq https://github.com/itchyny/gojq#difference-to-jq > accepts yaml input; so, if you happen to have a bunch of _almost_ structured data then some light sprinkling can turn it into yaml and then you're back in the loving embrace of the jq transformation/mutation language :heart: $ cat some-vendor-nonsense.txt product id: 5 price: 3.14 product id: 6 price: 6.66 $ sed "s/^/ /; s/^ pr…
Re: To a Man with `Jq`, Everything Looks Like JSON
#7There is still a quite good bootstrap customizer at bootstrap.build btw ;)
Re: To a Man with `Jq`, Everything Looks Like JSON
#8heh, wait until one discovers that gojq https://github.com/itchyny/gojq#difference-to-jq > accepts yaml input; so, if you happen to have a bunch of _almost_ structured data then some light sprinkling can turn it into yaml and then you're back in the loving embrace of the jq transformation/mutation language :heart: $ cat some-vendor-nonsense.txt product id: 5 price: 3.14 product id: 6 price: 6.66 $ sed "s/^/ /; s/^ pr…
Re: To a Man with `Jq`, Everything Looks Like JSON
#9heh, wait until one discovers that gojq https://github.com/itchyny/gojq#difference-to-jq > accepts yaml input; so, if you happen to have a bunch of _almost_ structured data then some light sprinkling can turn it into yaml and then you're back in the loving embrace of the jq transformation/mutation language :heart: $ cat some-vendor-nonsense.txt product id: 5 price: 3.14 product id: 6 price: 6.66 $ sed "s/^/ /; s/^ pr…
Or just use "yq", if you need to parse yaml
Re: To a Man with `Jq`, Everything Looks Like JSON
#10jq has string interpolation too, so it can even get a little bit nicer: " \(.) "
I also want to draw the reader's attention to the magic of |@uri https://github.com/jqlang/jq/blob/jq-1.7/docs/content/manual...> for a bunch of cases, but doubly so in TFA's case where they're plugging strings into a URI context. Simple string concat often works great for "hello world", but the world is not always just hello, so one quick use of the filter and jq's got your back
echo "the world's scary" | jq -Rr '"\(.)"'