We have a JSON file that needs to be multi-lined instead of being single lined as shown below,
{this is the first block},{this is the second block, really},{this is the third you're kidding:no}
We expected it to be like this so that it can be fed to an external program to read it without issues,
{this is the first block}
{this is the second block, really}
{this is the third you're kidding:no}
I'm not an expert with simple text processing tools like awk, sed, cut but I did try with sed for sometime unsuccessfully.
cat test.json | sed 's/},/\n/g'
{this is the first block
{this is the second block, really
{this is the third you're kidding:no}
What is the best way to do this?
}\ninstead of\nin your sed attempt[and ending with]. Is that the case for your real data?jq -c '.[]' <infile.jsonwill do the job).echo '[{"a":0},{"b":1},{"c":2}]' | jq -c '.[]'