Reputation: 23
I want to find absolute path of link from a web page source.
For example in a web page source, there is a line like this:
href="lectures/lecture04.pdf"
But the absolute path for this is
www.abc.com/courses/cs101/lectures/lecture04.pdf
Is there a way to get this path in bash shell?
Upvotes: 2
Views: 616
Reputation: 4470
Try:
$ wget --convert-links URL
From the wget
manual, the switch --convert-links
is described as follows:
The links to files that have not been downloaded by Wget will be changed to include host name and absolute path of the location they point to.
Example: if the downloaded file /foo/doc.html links to /bar/img.gif (or to ../bar/img.gif), then the link in doc.html will be modified to point to
http://hostname/bar/img.gif
.
Upvotes: 4