【发布时间】:2016-10-06 13:50:14
【问题描述】:
我有一个文本文件bak.txt,内容如下:
^[[34mINFO^[[0m[0000] Your engine version 1.11.1-cs1 is compatible
^[[34mINFO^[[0m[0000] We detected local components of UCP instance H7LQ:WKR5:G2PX:4F3V:JQ47:WCIG:JV4W:V6SE:4WMR:TLZN:XYWH:MIEQ
^[[31mFATA^[[0m[0000] Re-run the command with "--id H7LQ:WKR5:G2PX:4F3V:JQ47:WCIG:JV4W:V6SE:4WMR:TLZN:XYWH:MIEQ" or --interactive to confirm you want to upgrade this UCP instance.
我现在正在尝试使用以下命令从 bak.txt 文件中 grep UCP instance 值:
grep -Po '(?<=instance=)[^"]*' bak.txt
它不工作。请提出正确的方法。
【问题讨论】: