Veritas-bu

Re: [Veritas-bu] Script Help - BPIMMEDIA Output

2007-06-19 19:38:23
Subject: Re: [Veritas-bu] Script Help - BPIMMEDIA Output
From: Darren Dunham <ddunham AT taos DOT com>
To: Veritas-bu AT mailman.eng.auburn DOT edu
Date: Tue, 19 Jun 2007 16:21:16 -0700 (PDT)
> Here's what I have so far:
> =20
> DATE=3D`date +%m%d%y_%T`

Can I ask why that date format?  :-)  Something that sorts nicely is
usually worth it.

> NBUPATH=3D/usr/openv/netbackup/bin/admincmd
> CUSTVLTPATH=3D/usr/openv/netbackup/vault/sessions/Vault
> LASTSID=3D`cat $CUSTVLTPATH/session.last`
> CUSTSIDPATH=3D/usr/openv/netbackup/vault/sessions/Vault/sid$LASTSID
> OUTFILE=3D/var/tmp/vltsid$LASTSID_$DATE
> =20
> for MEDIAID in `more +2 $CUSTSIDPATH/eject.list | awk '{print $1}'`;
>         do=20
>         printf "$MEDIAID\n" >> $OUTFILE
>         $NBUPATH/bpimmedia -mediaid $MEDIAID -l | grep IMAGE | awk
> '{print $2,$4,$5}' >> $OUTFILE
>         printf "\n" >> $OUTFILE
> done=20
> 
> =20
> This script gives me output with the mediaid on the line above all the
> images, but instead, I want it repeated at the beginning of each line of
> images.

You'd need to add it in your awk's 'print' statement.  However with the
single quotes, that makes it tricky.  Maybe something like:

... | awk "{print \"$MEDIAID\" \$2,\$4,\$5}" >> $OUTFILE

> I also need to get the backup date in a human readable format
> and cannot figure out how to separate the ctime from the backupid to run
> it against bpdbm -ctime to get the real time. I have tried to use read,
> but it would not work for me.

You could use 'tr' to strip all non-numerics.

echo $MEDIAID | tr -d -c '0-9'

Of course I prefer to do all this in perl in most cases, but that's just
me.



-- 
Darren Dunham                                           ddunham AT taos DOT com
Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >
_______________________________________________
Veritas-bu maillist  -  Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu

<Prev in Thread] Current Thread [Next in Thread>