I have url like:
sftp://user@host.net/some/random/path
I want to extract user, host and path from this string. Any part can be random lengt
If you have access to Node.js:
export MY_URI=sftp://user@host.net/some/random/path
node -e "console.log(url.parse(process.env.MY_URI).user)"
node -e "console.log(url.parse(process.env.MY_URI).host)"
node -e "console.log(url.parse(process.env.MY_URI).path)"
This will output:
user
host.net
/some/random/path