How to chain grep to match images between double quotation marks?
$ cat final.html | grep -Po 'src=\".*?\"'
src="Remix-OS-Download-Option.png"
src="VMSetup1.png"
src="VMSetup2.png"
src="VMSetup3_001.png"
src="VMSetup4.png"
src="VMSetup5.png"
src="VMSetup6.png"
Expected result:
Remix-OS-Download-Option.png
VMSetup1.png
...
VMSetup6.png
Hope this will be helpful. As we are using perl regular expression here you can check demo here
Pipe your Command with: grep -Po '="\K[^"]+'
Regex: ="\K[^"]+
1.
="\Kthis will match="and\Kwill reset the current match.2.
[^"]+match all except"
Complete command:
cat final.html | grep -Po 'src=\".*?\"' | grep -Po '="\K[^"]+'
Optionally you can try this one: cat final.html | grep -Po 'src="\K[^"]+'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With