Small Advanced Bash Script For Copy/Paste....
I'd sure appreciate a solution to my problem if anyone can help me?
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-300,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-300,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 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.(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. Can this be achieved via sed and awk? I sure hope so. Thanks Gary |
followup
For consistincy sake substitute !PZ325,200; instead of !PZ300,200; as the first value in the text where it gets sniped. The 325 will always equal $SURFACE
|
All times are GMT -5. The time now is 09:00 PM. |