<分区>
我在文件中有一个原始的未格式化字符串,如下所示。
"],"id":"1785695Jkc","vector":"profile","
"],"id":"jashj24231","vector":"profile","
"],"id":"3201298301","vector":"profile","
"],"id":"1123798749","vector":"profile","
我只想提取如下的 id 值
1785695Jkc
我试过下面的命令
grep -o -P '(?<="],"id":").*(?=",")' myfile.txt >new.txt
但这需要 ","
的最后一次出现,如下所示
1785695Jkc","vector":"profile
但我只需要在第一次出现时拆分。