Skip to content
Advertisement

Remove extra quotation marks in the grep output

TUNNEL_TCP=$(grep -Po 'http://([S]*?)"' ./tunnel_info.json )

the above cammand is used to get an http link example: www.224.ngrok.io but the output is say www.224.ngrok.io”

How can I remove the extra ” at the end?

I tried editing the ” from the grep command but it doesn’t work.

Advertisement

Answer

You can use positive lookahead:

grep -Po 'http://([S]*?)(?=")'

(?=")matches the " without making it part of the match.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement