请解释如何使用grep命令从以下json中提取一些指定的文本 -
{"result":"Customer information saved successfully with Customer id :59 and version :1","status":{"responseCode":200,"result":null,"responseMessage":"Success","responseType":"info"}}
Run Code Online (Sandbox Code Playgroud)
经过一些谷歌搜索后,通过使用带正则表达式的grep看起来是可能的.但它没有用.你能指出错误吗?
cat response.txt | grep -Po '(?<="Customer id ":)[0-9]+'
Run Code Online (Sandbox Code Playgroud)
假设:response.txt包含上面的json.
如果是,请解释.
我需要一个脚本,在每行的末尾添加一个特定的字符.我正在使用命令
sed的/ $/foo /'r.txt
它将foo添加到文件r.txt中每行的末尾并显示在我的终端中.如果我想在每行结束后附加此新记录来保存此现有文件,我该怎么办?