要将一个json文件中的所有"github.com"改为"kgithub.com",可以使用sed命令。假设json文件名为example.json,可以使用以下命令:

sed -i 's/github\.com/kgithub\.com/g' example.json

此命令将替换example.json文件中的所有匹配项,并将更改保存在原始文件中(使用-i选项)。

如果你不想更改原始文件,可以使用以下命令:

sed 's/github\.com/kgithub\.com/g' example.json > new_example.json

这将在标准输出中生成一个新的json文件new_example.json,其中"github.com"被替换为"kgithub.com"。

shell 把一个json中所有githubcom 改成 kgithubcom

原文地址: https://www.cveoy.top/t/topic/iWdq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录