In my bash script I need to extract just the path from the given URL. For example, from the variable containing string:
http://login:password@example.com/one/more/dir/fi
How does this :?
echo 'http://login:password@example.com/one/more/dir/file.exe?a=sth&b=sth' | \ sed 's|.*://[^/]*/\([^?]*\)?.*|/\1|g'