in reply to pattern matching

First, learn to use the formatting tools available. In particular, you should have noticed when you hit 'preview' that your text had run together. You probably wanted that in code tags.

Second:

#!/usr/bin/perl use strict; use warnings; while (<>) { print "found '$1'\n" if /:([^;]+)/; } __END__

which when given the input file you describe via a call like

./foo.pl input_file

will print

found ' karemaips01' found ' karemadom02' found ' karemadbo01' found ' karemadom01.emea.pfizer.com' found ' karemasss05' found ' ka-lvsapp' found ' emakars001.pfizer.com' found ' ka-lvsn1' found ' ka-efss' found ' ka-lvsn2' found ' karemafil-c' found ' ka-lvscluco' found ' ka-lvsdb'