Use jq to edit an existing file in-place


The jq tool is amazing, but it won’t change an existing file in-place. Here’s a hack using ex to get around that:

jq ... input.json | ex -sc 'wq!input.json' /dev/stdin

More info on ex

Tags:  json

Share: