First I'd like to thank everyone for their help with scripts, 
I recieved quite a few that were all excellent resources for creating
my own.

I have a tape rack that holds 35 tapes, and an robotic arm tape changer
that picks up the tapes and sticks them in the tape drive(s).

I modified chg-zd-mtx, specifically the readstatus line, to read like:

usedslot=`$MTX -f /dev/sg3  status | sed -n 's/Data Transfer Element
0:Empty/-1/p;s/Data Transfer Element 0:Full (Storage Element
\(.\) Loaded):VolumeTag = DNR\(.\)\(.\)\(.\)/\1/p'`


This worked great!! For the first 9 tapes... and I realized why.
In the previous line the number after Storage Element is read into 
?variable?  \(.\)  <- This represents one number.  In order to go
higher than 9 though I had to add a second \(.\) and a \2 so that it looks 
like:

usedslot=`$MTX -f /dev/sg3  status | sed -n 's/Data Transfer Element
0:Empty/-1/p;s/Data Transfer Element 0:Full (Storage Element
\(.\)\(.\) Loaded):VolumeTag = DNR\(.\)\(.\)\(.\)/\1\2/p'`

My question is, is there a more elegant way (without scraping the whole
script and trying a completely new one -- leading to more headaches and
troubleshooting) to do what I'm trying to do? (i.e.-- read higher than one
digit numbers, and possibly two digit -- though honestly I'm not at that
point yet)

As soon as I try and use this script to do any amcheck or dumping to the
first 9 tapes, I'll have to revert everything back.  

Hope I explained this clearly enough, and that someone out there with more
intelligence than I in scripting can help out.

Joe

Reply via email to