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 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

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


SEE ALSO

Commands:
htsplit, web


PTC MKS Toolkit 10.4 Documentation Build 39.