Parse fully qualified domain names from file

I ran in to a situation where i needed to parse all fully qualified domain names (FQDN) from bunch of files in the same directory.

Here is how to do that:

grep -R -h -Eo '(http|https)://[^/"]+' . | awk -F'/' '{ print $3 }' | sort | uniq

To remove the path from a list of domains + path:

sed 's/.*\///'Code language: JavaScript (javascript)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.