gpt4 book ai didi

linux - linux 中的子字符串基于第一次出现

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:17:31 26 4
gpt4 key购买 nike

<分区>

我在文件中有一个原始的未格式化字符串,如下所示。

"],"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

但我只需要在第一次出现时拆分。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com