Quote:
Originally Posted by miller
You need to more explicitly state what you're trying to do. Are you trying to simply see if this "specific" hostname is within a line. Are you trying to extract the hostnames? And they are always the first item in the record? There are many different types of goals that would require a different regular expression, but since you didn't specify, I'll simply assume the easiest.
-
if ($line =~ m{\b\Qhost.domain.com\E\b}) {
-
print "specific host found";
-
} else {
-
print "not found";
-
}
-
All that does is search for the literal string "host.domain.com" with word boundaries surrounding it. If you need help with anything more specific, you'll have to specify.
Sorry, miller.
Yes, I will extract only the hostnames and they will be the 1st item in the record.
Okay, I saw that you used the word boundary -- I didn't think to use that. :)
Thanks!!