当前位置:网站首页>shell读取Json文件的值
shell读取Json文件的值
2022-06-28 18:41:00 【51CTO】
json文件profile.json
获取数据
#第一个管道将每行的逗号去掉;第二个管道去掉{和};第三个管道去掉所有双引号;第四个管道替换第一个:为=号
data
=
$(cat profile.json | sed -r
's/",/"/'
| egrep -v
'^[{}]'
| sed
's/"//g'
| sed
's/:/=/1'
)
#如果json的值直接没有换行符则使用下面的方法获取
#data=`cat data.json |sed 's/,"/\n/g' |grep -v IAM_Server |sed 's/":"/=/g;s/"$//g;s/^{"//g;s/"}//g'`
declare
$data
#声明变量
echo
$Mysql_Port
#查看变量值
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.

边栏推荐
猜你喜欢
随机推荐
从知名软件提取出的神器,吊打一众付费
Taishan Office Technology Lecture: word strange font height
BioVendor游离轻链(κ和λ)Elisa 试剂盒检测步骤
Modular operation
About Significance Tests
【Unity3D】发射(RayCast)物理射线(Ray)
618 activity season - the arrival of special discounts for hundreds of low code platforms
Huawei cloud AOM released version 2.0, and three features appeared
用户网络模型与QoE
1 invalid import format(s) Postman Collection Format v1 is no longer supported and can not be import
Opengauss kernel: analysis of SQL parsing process
devpi
深入解析kubernetes中的选举机制
3D rotatable particle matrix
Object tracking using tracker in opencv
Lumiprobe非荧光炔烃研究丨DBCO NHS 酯
leetcode 1647. Minimum Deletions to Make Character Frequencies Unique(所有字母频率不同的最小删除次数)
Business layer modification - reverse modification based on the existing framework
Advanced technology management - how managers communicate performance and control risks
从理论到实践增强STEAM和工程教育









