urlparse
urlparse OPTIONS URL_TO_PARSE
urlparse can parse a URL and return the specific elements requested (e.g. protocol, hostname, path, query string)
With no options returns “http.commy/page.html”
urlparse http://example.com/my/page.html
Get protocol. Returns “http”.
urlparse -protocol http://example.com/my/page.html
Get host or domain name. Returns “example.com”.
urlparse -host http://example.com/my/page.html
Get path. Returns “/my/page.html”.
urlparse -path http://example.com/my/page.html
Get dirname. Returns “my”
urlparse -dirname http://example.com/my/page.html
Get basename. Returns “page.html”.
urlparse -basename http://example.com/my/page.html
Get extension. Returns “.html”.
urlparse -extname http://example.com/my/page.html
Without options urlparse returns protocol, host and path fields separated by a tab.
urlparse 1.2.10