garyinspringhil 0 Newbie Poster

I have a series of variables like so:
$BLACKPASS=7
$BLACKCUTDEPTH=567
$SURFACE=325
NUMBEROFPASSES=$((($BLACKCUTDEPTH-$SURFACE )/$BLACKPASS)) #is 34

Text To Edit:
IN;
PU;
SP6;
!PZ-325,200; snip here (inclusive)SP6 is a known/usable starting point
VS25;
PU9170,-10213;
PD9170,-10827;
PD7967,-10827;
PD7967,-10213;
PD9170,-10213;
PD9170,-10213;
PU9170,-10213; snip stops here inclusive BEFORE the next SPx line
SP7;
!PZ-325,200;
VS8;
PU8074,-9384;
PD8266,-8972;
PD8036,-8580;
PD8487,-8636;
PD8789,-8296;
PD8876,-8742;
PD9292,-8924;
PD8894,-9144;
PD8850,-9597;
PD8518,-9286;
PD8074,-9384;
PD8074,-9384;
PU8074,-9384;
PU;
PU30000,20000;IN;

What I need to do is take the snip and duplicate it and paste it at the end snip point (before the next SPx) over and over via a loop I already have based on $NUMBEROFPASSES. As each snip gets pasted in line the !PZ-xxx,200 needs to be changed in relation to the diff $BLACKCUTDEPTH-$SURFACE which is 242. I need the number 242 equally divided up over the number of snips and the increasing incremental diff. patched where the xxx is in !PZ-xxx,200 until in this case $BLACKCUTDEPTH 567 is reached.(the first !PZ-xxx,200 is left alone and all following strings have the patch applied increasing in numerical value. The 200 stays constant as do the SP6; and others SP#'s. The size of the snip will vary from a few lines to a thousand. The needed code will be used for SP1 through SP7 but I will duplicate and edit code for each SPx as needed.
Can this be achieved via sed and awk? I sure hope so.

Thanks
Gary