This is a part of my package.json file
{
"name": "org-team-module",
"version": "1.1.0-snapshot",
"description": "Some description",
"scripts": {
"start": "npm run build && npm run copy-static-assets && npm run serve",
"build": "rimraf dist && npx tsc && echo npm run lint",
I want to replace the version with a particular value, say 1.2.0-snapshot
This is what i have till now;
sed -nE -i 's/(^\s*"version": ")(.*?)(",$)/\11.2.0-snapshot\3/p' test.json
However when I add the -i flag to replace; the entire file gets replaced with the searched value. i.e. the entire file contents after replace is
"version": "1.2.0-snapshot",
How can i just replace that particular line in the file