I have a few .json files in my directory. If I do:
find . -name '*.json' -exec echo "{\"filename\": \"{}\", \"content\": `cat {}` }," \;
I get:
{"filename": "./a.json", "content": },
{"filename": "./b.json", "content": },
However, if I do:
find . -name '*.json' -exec echo "{\"filename\": \"{}\", \"content\": cat {} }," \;
I get:
{"filename": "./a.json", "content": cat ./a.json },
{"filename": "./b.json", "content": cat ./b.json },
so how do I make the a.json and b.json contents be cated correctly ?
BTW, if I do:
find . -name '*.json' -exec cat {} \;
the json files are correctly printed in the console, so I know that the file contents are valid.
jqutility.jqtoo for what I am trying to do.