i can only find the first occurance of a pattern how do i set it to loop untill all occurances have changed.
#! /usr/bin/perl
use POSIX;
open (DFH_FILE, "./dfh") or die "Can not read file ($!)";
foreach (<DFH_FILE>) {
if ($_ !~ /^#|^$/) {
chomp;
($dfhtype, $dfh) = split(/=/, $_);
$dfhtype=lc("$dfhtype");
$dfhhash{$dfhtype}=$dfh;
}
print "ORIGNAL:$dfhtype=$dfhhash{$dfhtype}\n";
}
close DFH_FILE;
while (($client, $dfh) = each (%dfhhash)) {
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$dfh =~ /\`date \+(%.*?)\`/;
$str = strftime( "$1",$sec, $min, $hour, $mday, $mon, $year, $wday);
print "CHANGED:$client=$`$str$'\n\n";
print "DATE:$1\tTIME:$str\n";
}
[qgatu003]/export/home/mxdooley/mbi_script$./test.pl
ORIGNAL:q155944="DFH 1 CW_OMS q155`date +%Y%m%d%H%M%S` `date +%Y%m%d%H%M%S` q155944o01"
CHANGED:q155944="DFH 1 CW_OMS q15520031205172139 `date +%Y%m%d%H%M%S` q155944o01"
other various DFHes:
ACCESSDBTXT="DFH,1,q100,CW_TMS,`date +%Y%m%d`,`date +%H%M%S`,`date +%Y%m%d%H%M%S`,q100204i,0,1"
Q155940="DFH|1|q155|CW_OMS|`date +%Y%m%d`|`date +%H%M%S`|`date +%Y%m%d%H%M%S`|q155940i|0|1"