|
|
|
|
|
by mdaniel
927 days ago
|
|
heh, 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/^ product/- product/" < some-vendor-nonsense.txt \
| gojq --yaml-input .
|
|