#!/usr/local/bin/perl
# file - sar-d.pl
$sar_out = "/tmp/sar.out";
$sar_dat = ">/tmp/sar.dat";
# a file suitable for SQLLDR is created as /tmp/sar.dat
system("sar -d > $sar_out"); 
open(INP,$sar_out);
open(OUT,$sar_dat);
$line_cnt = 1;
while (<INP>) { 
   if ( ($line_cnt > 4) && (length($_) > 1) )
   {
      if ( (substr($_,0,1) ne " ") && (substr($_,0,1) ne "A") )
      {
         $timestamp = substr($_,0,8);
         #print "$timestamp\n";
         $input = $_;
      } else
      {
         $input = $timestamp . substr($_,8);
      }
      print OUT $input;
   }
   $line_cnt++;
}
close(INP);
close(OUT);
unlink($sar_out);

HTH & HAND!

> By chance, does anyone have a script that will reparse a collection of sar 
>statistics, that came from "sar -d", into a file that can be used by SQL*Loader?

-- 
Charlie Mengler               Maintenance Warehouse  
[EMAIL PROTECTED]              10641 Scripps Summit Ct   
858-831-2229                  San Diego, CA 92131    
HOME DEPOT - The Big Boy's Toy store!!!!!!!!!!!!!!!!!
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Charlie Mengler
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to