I had the same problem. After a few hours of pulling out my hair I found that 
the log files are full of nulls padding each letter. I had to something like 
s/\x00// to kill all of the nulls.
 
Damon> From: [EMAIL PROTECTED]> To: [email protected]> 
Subject: Server 2003 NTBackup Log Files> Date: Thu, 20 Mar 2008 19:52:44 +0000> 
CC: [EMAIL PROTECTED]> > Hi All,> > I've got a couple of problems with checking 
backup log files generated by> windows 2003 server ntbackup. First and biggest 
problem is that> backup[01-10].log files are unicode and when I open them and 
check for> different strings I get no matches as it opens them in unicode and 
not> ascii. I've searched everywhere for unicode to ascii conversion but can't> 
find anything. Is there a simple way to open or convert the log file as> ascii 
so I can do what I need to do? Here's the code I'm using to open the> file:> > 
open(LOG,"<$backup_log_absol");> flock(LOG, 2);> my (@backlog) = <LOG>;> close 
(LOG);> > Pretty standard but useless!!> > Secondly, although not really a 
problem, is there any way I can condense the> following code:> > opendir DIR, 
$log_dir or die "Error reading $log_dir: $!n";> my @sorted = sort {-M 
"$log_dir/$b" <=> -M "$log_dir/$a"}> readdir(DIR);> closedir DIR;> 
my(@logfiles);> foreach (@sorted) {> unless (($_ eq ".") or ($_ eq "..") or ($_ 
eq "fred.bks")) {> push @logfiles, "$_";> }> }> my $newestfile = 
$logfiles[-1];> > As you can see I'm opening the ntbackup log file directory 
away in docs &> settings to find the newest file thats not ".", ".." or 
"fred.bks". It seems> dirty code to me and I'm sure it could be written 
better.> > Thanks in advance for any help,> > Ewen> > 
_______________________________________________> ActivePerl mailing list> 
[email protected]> To unsubscribe: 
http://listserv.ActiveState.com/mailman/mysubs
_________________________________________________________________
How well do you know your celebrity gossip?
http://originals.msn.com/thebigdebate?ocid=T002MSN03N0707A
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to