修改json文件
2024-10-01 11:53:28
第三方库jq
https://stedolan.github.io/jq/manual/
cat old_deploy.json \ | jq --arg cpu_limit $cpu_limit 'setpath(["spec", "template", "spec", "containers", 0, "resources", "limits", "cpu"]; $cpu_limit)' \ | jq --arg memory_limit $memory_limit 'setpath(["spec", "template", "spec", "containers", 0, "resources", "limits", "memory"]; $memory_limit)' \ > new_deploy.json
读取文件文本
while read line do echo "$line" done < /tmp/nginx.yaml
修改文本文件(逐行匹配,替换)
sed -i 's/\("host":"\).*/\1192.168.0.1",/g' rabbitmq.json
cat rabbitmq.json { "rabbitmq": { "ssl": false, "host":"192.168.0.1", , "vhost": "/sensu", "user": "sensu", "password": "sensu" } }
最新文章
- Linux初学 - SSH
- SSE:服务器发送事件,使用长链接进行通讯
- Qt 5.3.1 版本应用程序的发布问题
- 插入排序和一点小感悟(c++版)
- graph-tool文档(一)- 快速开始使用Graph-tool - 1.创建和操纵图
- asp.net正则表达式过滤标签和数据提取
- java中path和classpath
- 移动端的click
- java之SpringMVC的controller配置总结
- python 速记正则使用(转)
- CMS GC启动参数优化配置
- Python中crypto模块进行AES加密和解密
- C# 图片人脸识别
- babel更新之后的 一些坑
- sqlserver table partion
- hashCode及HashMap中的hash()函数
- Oracle EBS不能正常启动的解决方案 >; Jinitiator 乱码
- EasyPlayer RTSP Windows(with ActiveX/OCX插件)播放器支持H.265播放与抓图功能
- eclipse基础环境配置和svn、maven的配置以及maven的安装
- UNDO表空间损坏导致数据库无法OPEN
热门文章
- Vivado HLS初识---阅读《vivado design suite tutorial-high-level synthesis》(6)
- MyEclipse+Tomcat配置
- centos 磁盘清理 /dev/vda1系统盘满了
- 四旋翼基础算法学习2-IMU输入滤波算法
- RTB业务知识之2-Impression概念和关键属性
- 使用googletest进行C++单元测试(Netbeans为例)
- 【Git】Git使用--常用命令
- python3 urllib模块使用
- 【Web前端】div层调整zindex属性无效原因分析及解决方法
- tarroni music