当前位置:网站首页>Shell reads the value of the JSON file
Shell reads the value of the JSON file
2022-06-28 20:04:00 【51CTO】
json file profile.json
get data
# The first pipe removes commas from each line ; Remove the second pipe { and }; The third pipe removes all double quotes ; The fourth pipe replaces the first : by = Number
data
=
$(cat profile.json | sed -r
's/",/"/'
| egrep -v
'^[{}]'
| sed
's/"//g'
| sed
's/:/=/1'
)
# If json If there is no newline character in the value of, use the following method to obtain
#data=`cat data.json |sed 's/,"/\n/g' |grep -v IAM_Server |sed 's/":"/=/g;s/"$//g;s/^{"//g;s/"}//g'`
declare
$data
# Declare variables
echo
$Mysql_Port
# View variable values
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.

边栏推荐
- Variable autoencoders (vaes)
- H5 sunflower operation
- Figure introduction to neural networks (GNN, GCN)
- Priority problem when local variables and global variables in C language have the same name (when local variables and global variables exist at the same time, local variables are preferred to be refer
- 《数据安全法》出台一周年,看哪四大变化来袭?
- Windows 64 bit download install my SQL
- C语言局部变量与全局变量重名时的优先级问题(当局部变量和全局变量同时存在的时候,优先引用局部变量,而不去引用全局变量)
- 【324. 摆动排序 II】
- Risc-v instruction set
- Analysis of all knowledge points of TCP protocol in network planning
猜你喜欢

Analysis of all knowledge points of TCP protocol in network planning

Parallax JS special effect JS carousel map plug-in

Bayesian inference problem, MCMC and variational inference

颜色渐变的FontAwesome图标

R language GLM generalized linear model: logistic regression, Poisson regression fitting mouse clinical trial data (dose and response) examples and self-test questions

Redis 如何实现库存扣减操作?如何防止商品被超卖?
![[324. swing sequence II]](/img/4f/dbbc28c7c13ff94bd0956f2ccf9603.png)
[324. swing sequence II]

Demo of intelligent computing system 2 bangc operator development (heterogeneous programming flow of CPU and mlu270)

【Go语言刷题篇】Go从0到入门5:Map综合复习、条件语句、循环语句练习

2022年P气瓶充装考试练习题及在线模拟考试
随机推荐
Concours de segmentation des images gastro - intestinales de kaggle Baseline
管道 | 与重定向 >
522. 最长特殊序列 II(贪心&双指针)
R语言GLM广义线性模型:逻辑回归、泊松回归拟合小鼠临床试验数据(剂量和反应)示例和自测题
Xiaobai's e-commerce business is very important to choose the right mall system!
F (x) construct the equation, calculate the partial derivative by gradient descent, determine the partial derivative adjustment by loss function, and deal with nonlinear problems by activation functio
Tencent tangdaosheng: facing the new world of digital and real integration, developers are the most important "architects"
Leetcode week 299
视差js特效js轮播图插件
论文阅读:Duplex Contextual Relation Network for Polyp Segmentation
redisTemplate
How does win11 slim down the system disk? Slimming method of win11 system disk
2022年P气瓶充装考试练习题及在线模拟考试
Analysys analytics' 2022 China Banking privacy computing platform supplier strength matrix analysis' research activity was officially launched
Priority problem when local variables and global variables in C language have the same name (when local variables and global variables exist at the same time, local variables are preferred to be refer
类加载机制与对象的创建
Day88.七牛云: 房源图片、用户头像上传
Judge whether the string is empty
Parallax JS special effect JS carousel map plug-in
2280.Cupboards