How to edit a json file by shell script to change the coordinate point , in which original points are divided by 2 How to edit a json file by shell script to change the coordinate point , in which original points are divided by 2 shell shell

How to edit a json file by shell script to change the coordinate point , in which original points are divided by 2


The shell is an unsuitable tool to parse json and do math. In perl this is a one-liner:

$ perl -pe '/point/ && s,(\d+),$1/2,eg' inputfile{    "planetsQuestion":[        {            "state":"Andhra Pradesh",            "capital":"Hyderabad",            "point":["260","275"]        }, {            "state":"Arunachal Pradesh",            "capital":"Itanagar",            "point":["443","147"]        }   ]}