url

parse Uniform Resource Locators (URLs) 

Command


SYNOPSIS

url [-hpPsuUx] url...


DESCRIPTION

The url command parses URLs for use in shell scripts and displays selected portions.

Options

-h 

displays the hostname; for example, if you specify

url -h http://www.mks.com

url returns

www.mks.com
-p 

displays the port number. The default port number is 80.

-P 

displays password authorization if it is encoded in the URL.

-s 

displays the scheme; for example, if you specify

url -s http://www.mks.com

url returns

http
-U 

displays the user authorization if it is encoded in the URL.

-u 

displays the URL path name.

-x 

displays everything after and including a ? or # in the specified URL. For example,

url -x http://www.mks.com/foobar?foo

returns

?foo


EXAMPLES

To get a list of all web sites that a given page refers to:

for page in $(web get http://www.site.com/ | htsplit | awk '
	/HREF/ {
		sub(/^.*HREF="/, "")
		sub(/".*$/, "")
		print
	}')
do
	url -h $page
done | sort -u

DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


NOTES

This utility uses the wininet.dll dynamic link library; if you don't have it on your system, you must obtain it from Microsoft.


PORTABILITY

Windows 2000. Windows XP. Windows Server 2003. Windows Vista.


AVAILABILITY

MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
htsplit, web


MKS Toolkit 9.2 Documentation Build 16.