O
O
oleww052019-01-20 02:50:46
bash
oleww05, 2019-01-20 02:50:46

How to find the word between..?

Help me to understand.
How to search inside a text file, you need to find this expression: CDIQAA
"nextPageToken": "CDIQAA",
Tried to use like this, does not fit

a="\"nextPageToken\": \"CDIQAA\","
echo "$a" | grep -o '"[^"]*"'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DevMan, 2019-01-20
@oleww05

emnip, grep shows the string containing the search.
if you need a specific piece of string, then awk is the way to go.

X
xoo, 2019-01-20
@xoo

If I understand correctly, then

a="\"nextPageToken\": \"CDIQAA\","
echo "$a" | grep -oP '(?<=nextPageToken": ")[^"]+?(?=")'

finds the token

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question