Practical example using GREP command
Listing all sub-domains.
$ grep "href=" index.html | grep "\.yehey" | grep -v "www\.yehey\.com | awk -F "http://" '{print $2}' | cut -d "/" -f 1
This will list the following results.
mail.yehey.com
ssh.yehey.com
beta.yehey.com
.
.
Another options.
$ grep -o '[^/]*\.yehey\.com' index.html | sort -u > list.txt
$ cat list.txt
mail.yehey.com
ssh.yehey.com
beta.yehey.com
.
.
Different command parameters, same results.