Here's a nice perl script to strip the TSM headers

edyesed

ADSM.ORG Member
Joined
Oct 29, 2002
Messages
7
Reaction score
0
Points
0
Website
http
This is what I'm using. I have bash scripts that do jobs that admin client things like



++++shell script++++

#!/bin/bash

ID=id

PA=pa

MYOUTFILE=someoutput

STRIPTSMHEADERS=LocationOfFollowingPerlScript



dsmadmc -id=$ID -pa=$PA -comma -out=$MYOUTFILE \

"q event * *"



$STRIPTSMHEADERS $MYOUTFILE

++++end shell script++++



||||| begin perl STRIPTSMHEADERS|||||

#!/usr/bin/perl -w



# This should remove all the header lines from TSM output

# thus giving you a usable report to do as you wish

# It opens an argument and a temporary file

# strips the headers from the temp file

# and then renames the temp file to the

# original filename



my $filename = $ARGV[0];

my $tmpfilename = "temporary.dmp";

open ( FH , "$filename" ) || die "no open $!";

open ( FH2 , "> $tmpfilename" ) || die "no open $!";

# should open two files, a temp and the orig

while (<FH>) {

if ( $_ =~ /^(Tivoli|Command|\(C\)|\s|ANS8002I|ANR1462I)/ ) {

} else {

print FH2 $_;

}

}

close ( FH );

close ( FH2 );

rename ( $tmpfilename, $filename );

||||| end perl STRIPTSMHEADERS|||||||||||||||||
 
oops! meant to make that a relpy to another item!

-edyesed
 
Back
Top