If I have a line of text which looks like...
[garbage] <img src="[some url]" [garbage] /> [garbage]
Using sed, how can I get the URL that the image is pointing to? There are no other instances of src=
on that line.
If I have a line of text which looks like...
[garbage] <img src="[some url]" [garbage] /> [garbage]
Using sed, how can I get the URL that the image is pointing to? There are no other instances of src=
on that line.
cat html | sed -n 's/.*<img src="\([^"]*\)".*/\1/p'
The -n /p idiom allows you to ignore all the other lines in the file (i.e. do a sed and a grep in one go), while "([^"]*)" just says find the stuff in the quotes.