I need to replace one line in a ton of . json files

Ithorian [comrade/them, he/him]@hexbear.net to Linux@lemmy.ml – 33 points –

I'm updating foundry to a version 11 and it broke an ass ton of my assets cause they're all "verified version 10"

So all I have to do is change that number, they're just maps so no need to update anything else, but I have like 400+ files to convert all in individual folders.

Please tell me there's an easy way to do this. (I'm on Linux obviously)

33

You are viewing a single comment

find /path -name *.json -exec sed -i 's/from/to/g' {} ; -print

This, unless you want to mess with jq

Yeah, jq doesn't edit files, right? You'd have to have temp files or something? jq is so good handling json, I wish there was a way of using it to edit files.

You really want to do it that way anyway.. process the files to a new set of files. That way when you screw it up going back is just deleting the new files, fixing and rerunning.