Hi,<br><br>I have the following scenario where I need to extract node name information based on certain conditions from an application, and write the data out to a file and HUP the process concerned. I have managed to get to a certain point however need some advise.<br>
<br>Script output:<br><br>#!/usr/bin/perl<br>use strict;<br>use warnings;<br><br>## Cut down version of regex list<br><br>my @critical_device_def = (<br> [AAA => qr{...apb09} ],<br> [BBB => qr{...avggd09} ],<br>
[CCC => qr{...uytwop09} ],<br> [DDD => qr{...loupoi09} ]<br><br>); <br><br>my @DEVICE_LIST;<br>my $file = "rules.txt";<br>my @tokens;<br><br>open(UPDATE, ">$file") || die "Can't open new file: $!\n";<br>
<br>@DEVICE_LIST=`/opt/OV/bin/ovtopodump | awk '\$3 ~ /^[a-z]+.*\.my\.domain\.com\.au/{print \$3}'| uniq`;<br><br>foreach (@DEVICE_LIST)<br> { <br> for my $t (@critical_device_def)<br> {<br> my ($site, $device, $flag) = @$t;<br>
if ($_ =~ m/\G($device)/gc) <br> {<br> <br> print UPDATE "$_" ;<br> next;<br> }<br> <br> }<br> <br> }<br><br>=====<br><br>The problem I am having is that at the print UPDATE line, I need to append to the data a tab and the number 1. With the current code, the file output looks like this:<br>
<br><a href="http://cpploupoi09.my.domain.com.au">cpploupoi09.my.domain.com.au</a><br><a href="http://cpqavggd09.my.domain.com.au">cpqavggd09.my.domain.com.au</a><br><br>however, I need the contents to be printed to the file in the format below where the hostname then a tab and the number one is printed:<br>
<br><a href="http://cpploupoi09.my.domain.com.au">cpploupoi09.my.domain.com.au</a> <tab_space> 1<br>
<a href="http://cpqavggd09.my.domain.com.au">cpqavggd09.my.domain.com.au</a> <tab_space> 1<br><br>What is the best way to do this?<br><br>Also what is the best way to send a HUP signal to a running Unix process?<br>
<br>Appreciate your help.<br><br>