79653112

Date: 2025-06-04 15:58:23
Score: 0.5
Natty:
Report link

To expand on @johnsyweb's answer, here's an example of how to inline a small python script in bash to parse a URL:

URL="https://stackoverflow.com/questions/6174220/parse-url-in-shell-script"
HOST=$(URL=$URL python - <<EOF
import os
from urllib.parse import urlparse

uri = os.environ["URL"]
result = urlparse(uri)
host = result.netloc.split('@')[-1]
print(host)
EOF
)
$ echo $HOST
stackoverflow.com
Reasons:
  • Blacklisted phrase (1): stackoverflow
  • Has code block (-0.5):
  • User mentioned (1): @johnsyweb's
  • High reputation (-1):
Posted by: ealfonso