惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
V
Visual Studio Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
有赞技术团队
有赞技术团队
云风的 BLOG
云风的 BLOG
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
The Cloudflare Blog
Engineering at Meta
Engineering at Meta
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
Vercel News
Vercel News
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
M
MIT News - Artificial intelligence
小众软件
小众软件
月光博客
月光博客
A
About on SuperTechFans

Bash

Linux bash 脚本监控和重启一个守护进程 有个脚本代码的问题 Bash Script 代码比较,你认为哪个更加容易理解? 有使用 kitty 当日常终端的老哥吗? 在输入命令时,自动调用 fzf 进行模糊匹配 使用 shell 的 bash -c "functions"时,是不是所有相关的函数都得声明出来? shell 比较浮点数大小的问题,顺便吐槽以下 shell bash-completor:声明式编写 Bash 补全脚本 sudo 改用 pkexec 的问题 sed 如何查找替换反斜杠 lobash 发布 v0.5.0 版本 为什么这样写无法连接(join)数组各项? 如何使用 awk 打印 nginx 404 日志的目录 请教一下,怎么把向终端输入的内容重定向一份到文件? 求一个 wsl2 ubuntu20.04 的默认 /etc/bash.bashrc 如何让 bash 的补全 popup 显示 如何去除 Bash variable expansion 后加的单引号? 初学者写了个 bash 脚本,求大佬点评 tar 使用管道的困惑 如何获取命令标准输出到变量里并保留颜色?或者能不能一边输出一边赋值或判断。 请问如何在 alias 命令里传递参数? Bash 下如何优雅地临时在后台运行程序并易于管理? shell tr -cd 匹配字符串问题 shell 中的 import 能不能支持 as 或 alias 类似功能 Shell 多个文本间隔追加的方法 生产服务器集群被黑了,帮看看这个脚本 如何实现一个符合规范的 shell? 请教下如何检测文件是否存在 bash 里面有 io 多路复用吗? 闲的蛋疼,用 shell 写了个拓扑排序。。。
请教一下 shell 里使用 jq 处理 json 应该怎么写
Ryanjie · 2021-12-12 · via Bash

如题,有一个 json 文件,

[
    {
        "id": 0001,
        "name": "Zhang.San_123456",
        "email": {
            "qqmail": "[email protected]",
            "163mail": "[email protected]"
        },
        "Address": {
            "Province": "Guangdong",
            "City": "Zhanjiang",
            "Country": "Xuwen"
        }
    },
    {
        "id": 0002,
        "name": "Li.Si_123456",
        "email": {
            "qqmail": "[email protected]",
            "163mail": "[email protected]"
        },
        "Address": {
            "Province": "Sichuan",
            "City": "Yibin",
            "Country": "Jiang'an"
        }
    },
    {
        "id": 0003,
        "name": "Wang.Wu_123456",
        "email": {
            "qqmail": "[email protected]",
            "163mail": "[email protected]"
        },
        "Address": {
            "Province": "Shanxi",
            "City": "Taiyuan",
            "Country": "Qingxu"
        }
    }
]

我想获取里面 name 字段为 Li.Si_123456 的一部分,返回时移除 email 里的 163mail ,返回内容如下:

[
    {
        "id": 0002,
        "name": "Li.Si_123456",
        "url": "http://xxx.com",
        "qqmail": "[email protected]",
        "Address": {
            "Province": "Sichuan",
            "City": "Yibin",
            "Country": "Jiang'an"
        }
    }
]

请教一下这个使用 jq 处理应该怎么写呢,有大佬能指教一下吗?谢谢了^^