How to parse JSON with shell scripting?

牧云@^-^@ 提交于 2019-12-12 04:32:13

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!