Easiest way to extract the urls from an html page using sed or awk only


Question

I want to extract the URL from within the anchor tags of an html file. This needs to be done in BASH using SED/AWK. No perl please.

What is the easiest way to do this?

1
55
1/25/2011 1:15:34 PM

You could also do something like this (provided you have lynx installed)...

Lynx versions < 2.8.8

lynx -dump -listonly my.html

Lynx versions >= 2.8.8 (courtesy of @condit)

lynx -dump -hiddenlinks=listonly my.html
54
4/8/2015 2:21:59 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon