This is not a Perl answer but you may try logparser which is a powerful tool that allows you to submit SQL over many filetypes including MS logfiles. http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&displaylang=en Bour9
> -----Message d'origine----- > De : [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] De la > part de [EMAIL PROTECTED] > Envoyé : mardi 25 mars 2008 09:12 > À : Ewen Marshall > Cc : [email protected] > Objet : Re: Server 2003 NTBackup Log Files > > Hi Ewen, > the files are normally UTF-16 encoded. When you open it in > notepad and you > choose "Save as", you see it. Open the log files by > > open LOG,"<:encoding(UTF-16)",$backup_log_absol; > > and it should work. Perhaps you have to remove the first > bytes afterwards. > It is the BOM (byte order mark). > Bye > Torsten > > ________________________________________________________ > > > |---------+-------------------------------------------> > | | "Ewen Marshall" | > | | <[EMAIL PROTECTED]> | > | | Sent by: | > | | [EMAIL PROTECTED]| > | | veState.com | > | | | > | | | > | | 20.03.2008 20:52 | > | | | > |---------+-------------------------------------------> > > >------------------------------------------------------------- > -----------------------------------------------------------| > | > | > | To: <[email protected]> > | > | cc: [EMAIL PROTECTED] > | > | Subject: Server 2003 NTBackup Log Files > | > > >------------------------------------------------------------- > -----------------------------------------------------------| > > > > > 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 > > > > _______________________________________________ > ActivePerl mailing list > [email protected] > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
