[英]Regex - Shell scripting
I have a file which looks like this : 我有一个看起来像这样的文件:
{
"0" : NumberLong(654654),
"1" : NumberLong(31321),
"2" : NumberLong(44534564),
"3" : NumberLong(464564645),
}
My output should be something like this : 我的输出应该是这样的:
654654
31321
44534564
464564645
I tried to do this : 我试图这样做:
grep -Po ' NumberLong\("\K[^"]*' file
But it doesn't seem to work for me. 但这似乎对我不起作用。
Try this grep: 试试这个grep:
grep -Po ' NumberLong\(\K[^)]*' file
654654
31321
44534564
464564645
OR this grep: 或这个grep:
grep -Po ' NumberLong\(\K\d+' file
654654
31321
44534564
464564645
尝试
grep -Po ' NumberLong\(\K\d+' file
使用此命令: grep -Po "(?<=\\()[^)]+" data.txt
654654 31321 44534564 464564645
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.