问题
I have a JSON file from which I need to extract a few parameters and write into another file:
devDependencies": {
"gulp": "^3.9.1",
"gulp-angular-templatecache": "^1.9.1",
"gulp-bump": "^1.0.0"
}
I want to write a file that contains only
gulp gulp-angular-templatecache gulp-bump
How can I do that using a shell script?
回答1:
echo $(grep ^\" file| cut -d\" -f2)
But you shouldn't do any more complex json parsing with bash. This is also a hackish solution.
来源:https://stackoverflow.com/questions/41093119/how-to-parse-json-with-shell-scripting