0

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.

3 Answers 3

2

Try

grep -Po ' NumberLong\(\K\d+' file
Sign up to request clarification or add additional context in comments.

Comments

2

Try this grep:

grep -Po ' NumberLong\(\K[^)]*' file
654654
31321
44534564
464564645

OR this grep:

grep -Po ' NumberLong\(\K\d+' file
654654
31321
44534564
464564645

Comments

0

Use this: grep -Po "(?<=\()[^)]+" data.txt 654654 31321 44534564 464564645

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.