How to Extract Domain from URL in Bash

Posted on August 10, 2019 at 5:57 pm

Using awk you can extract a domain name from an URL:

echo http://example.com/index.php | awk -F[/:] '{print $4}'

The output is:

example.com

Receive updates via email

Other Posts

Updated Posts