I have a group of json files. Each file contains one json object and they all have the same schema. There is a field in the json that I want to rename the file to. How can I do that?
I came up with this solution:
find . -name '*.json' | xargs -i mv {} $(cat {} | jq '.billingAccountList[0]' | tr -d \").json
But it doesn't work, because cat is trying to interpret the {}. I was hoping the xargs would interpret it instead. It gives me this error:
cat: {}: No such file or directory