第三方库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"
  }
}

最新文章

  1. Linux初学 - SSH
  2. SSE:服务器发送事件,使用长链接进行通讯
  3. Qt 5.3.1 版本应用程序的发布问题
  4. 插入排序和一点小感悟(c++版)
  5. graph-tool文档(一)- 快速开始使用Graph-tool - 1.创建和操纵图
  6. asp.net正则表达式过滤标签和数据提取
  7. java中path和classpath
  8. 移动端的click
  9. java之SpringMVC的controller配置总结
  10. python 速记正则使用(转)
  11. CMS GC启动参数优化配置
  12. Python中crypto模块进行AES加密和解密
  13. C# 图片人脸识别
  14. babel更新之后的 一些坑
  15. sqlserver table partion
  16. hashCode及HashMap中的hash()函数
  17. Oracle EBS不能正常启动的解决方案 &gt; Jinitiator 乱码
  18. EasyPlayer RTSP Windows(with ActiveX/OCX插件)播放器支持H.265播放与抓图功能
  19. eclipse基础环境配置和svn、maven的配置以及maven的安装
  20. UNDO表空间损坏导致数据库无法OPEN

热门文章

  1. Vivado HLS初识---阅读《vivado design suite tutorial-high-level synthesis》(6)
  2. MyEclipse+Tomcat配置
  3. centos 磁盘清理 /dev/vda1系统盘满了
  4. 四旋翼基础算法学习2-IMU输入滤波算法
  5. RTB业务知识之2-Impression概念和关键属性
  6. 使用googletest进行C++单元测试(Netbeans为例)
  7. 【Git】Git使用--常用命令
  8. python3 urllib模块使用
  9. 【Web前端】div层调整zindex属性无效原因分析及解决方法
  10. tarroni music