[GNU grep] How to only get found pattern?
by littlebigman from LinuxQuestions.org on (#580JY)
Hello,
I need to 1) download a web page and 2) parse it to find three items.
For some reason, GNU grep (2.5.4) doesn't return just what it found through the patterns:
Code:wget -O input.html https://www.acme.com/blah.html
grep -Poh "accountid=\"(\d+?)\" playerid=\"(.+?)\" videoid=\"(\d+?)\"" input.htmlThis returns...
Code:accountid="876450610001" playerid="AkdH379s6" videoid="6189413688001"... while I just need "876450610001 AkdH379s6 6189413688001".
Any idea?
Thank you.


I need to 1) download a web page and 2) parse it to find three items.
For some reason, GNU grep (2.5.4) doesn't return just what it found through the patterns:
Code:wget -O input.html https://www.acme.com/blah.html
grep -Poh "accountid=\"(\d+?)\" playerid=\"(.+?)\" videoid=\"(\d+?)\"" input.htmlThis returns...
Code:accountid="876450610001" playerid="AkdH379s6" videoid="6189413688001"... while I just need "876450610001 AkdH379s6 6189413688001".
Any idea?
Thank you.