Shashank Shekher Shashank Shekher - 1 year ago 146
Bash Question

Parse below URL in bash

I have a URL like "http://host:port/cgi-bin/".
For the above URL i only need to get the value "/some/path/to/data/".
How can I fetch the required value from the above URL in a shell script.

Answer Source

If what you want is "everything after", it's very easy:

echo $path

Which will give you:


See the "Parameter expansion" section of the bash man page for details.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download