Skip to content

Instantly share code, notes, and snippets.

@sasqwatch
Forked from gwen001/ohost.sh
Created August 18, 2020 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sasqwatch/52984c4a87412aaffe7de509c9c60ea2 to your computer and use it in GitHub Desktop.
Save sasqwatch/52984c4a87412aaffe7de509c9c60ea2 to your computer and use it in GitHub Desktop.
onliner to resolve the host of a given url
host `echo https://pass:user@abracadabra-mms.starbucks.com:2996/utils/|sed "s/.*:\/\///"|cut -d '/' -f 1|cut -d '@' -f 2|cut -d':' -f 1`
function ohost {
host `echo $1|sed "s/.*:\/\///"|cut -d '/' -f 1|cut -d '@' -f 2|cut -d':' -f 1`
}
function ohosts {
while read u; do host `echo $u|sed "s/.*:\/\///"|cut -d '/' -f 1|cut -d '@' -f 2|cut -d':' -f 1`; done < $1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment