如何截取文本内的对应字符串
- 0次
- 2021-06-28 07:21:37
- idczone
如题 。文本内的内容为:request_5xx:1792 total_count:21878634 request_4xx:552 total_request_time:469576
假如想要 单独截取 request_4xx 对应的 552 改如何匹配呢?
正则表达式不行吗?
正则表达式不行吗?
echo request_5xx:1792 total_count:21878634 request_4xx:552 total_request_time:469576 | grep -Po '(?<=request_4xx:)\d+'
552
(request_4\w\w:)\s?\d*\s
替换为
$1 553
equest_5xx: 1792 total_count: 21878634 request_4xx: 552 total_request_time: 469576
变为
request_5xx: 1792 total_count: 21878634 request_4xx: 553 total_request_time: 469576
谢谢!
@VShawn。。额,已解决