regex help to get unique hostnames

Hi

I have a file containing hostnames like this

(host=myhost.domain.com) or
(host=myhost)

i need to extarct the unique hostnames without the domain names from that file.
so my output should be myhost (without domain names)

But my regex skills are rusty

i tried grep "host" myfile|uniq
but this matches host=myhost.domain.com 

instead of just everything after host=

any ideas on how do i construct my regex

$ 
$ cat f1
host=myhost1.domain1.com
host=myhost2
host=myhost3.domain3.com
host=myhost1.domain1.com
host=myhost1.domain1.com
host=myhost2
host=myhost4
$ 
$ perl -nle 's/host=//g; print' f1 | sort | uniq
myhost1.domain1.com
myhost2
myhost3.domain3.com
myhost4
$ 
$ 

tyler_durden

> cat hostfile
(host=myhost1.domain1.com)
(host=myhost2)
(host=myhost3.domain3.com)
(host=myhost1.domain1.com)
(host=myhost1.domain1.com)
(host=myhost2)
(host=myhost4)
> 
> 
> perl -nle 'if (/host=(.*?)(\.|\))/) {print $1}' hostfile | sort | uniq
myhost1
myhost2
myhost3
myhost4

A awk one:

$ cat f
(host=myhost1.domain1.com)
(host=myhost2)
(host=myhost3.domain3.com)
(host=myhost1.domain1.com)
(host=myhost1.domain1.com)
(host=myhost2)
(host=myhost4)

$ awk -F"[=.)]" '{h[$2]=1}END{for(i in h) print i}' f
myhost1
myhost2
myhost3
myhost4

Or:

$ awk -F"[=.)]" '!c[$2]++{print $2}' f