Linux grep命令从json中查找key的值

Linux grep命令从json中查找key的值,linux,Linux,请解释如何使用grep命令从以下json中提取某些指定文本- {"result":"Customer information saved successfully with Customer id :59 and version :1","status":{"responseCode":200,"result":null,"responseMessage":"Success","responseType":"info"}} 在谷歌搜索之后,通过使用正则表达式的grep看起来是可能的。但它不起作

请解释如何使用grep命令从以下json中提取某些指定文本-

{"result":"Customer information saved successfully with Customer id :59 and version :1","status":{"responseCode":200,"result":null,"responseMessage":"Success","responseType":"info"}}
在谷歌搜索之后,通过使用正则表达式的grep看起来是可能的。但它不起作用。你能指出错误吗

cat response.txt | grep -Po '(?<="Customer id ":)[0-9]+'
cat response.txt | grep-Po'(?尝试执行以下操作:

$ jq -r '.result' json_file | grep -oP '(?<=Customer id :)\d+'
59

$jq-r'.result'json_file | grep-oP'(?您错过了
K

cat response.txt | grep -Po 'Customer id :\K[0-9]+'
59
截图,其工作原理:

我知道jq工具,但我们的服务器上没有安装jq工具。除了使用grep命令,我别无选择。有可能吗?jq可以作为用户下载并直接执行,没有任何依赖项。grep可以自己读取文件,因此
grep…file
(cat的无用使用).而且,
\K
是OP已经使用的东西的简写,积极的外观behindit正在发挥作用…我遗漏了一些文字…你能详细解释一下吗..或者你能给我一个链接,在哪里可以找到关于它的详细文档。你能解释一下K在这里做什么吗?