Let's say a variable contains this string:
testvar="allocate channel c1 device type disk rate 20M maxopenfiles 1 format '/u900/backup/<oracle_sid>/database/backup_%d_<static_date_seq>_%t%s%p';"
What I need to do is:
1. preserve everything up to the word disk, then replace the word disk with 'SBT_TAPE'
2. preserve everything after the word disk up until the word "format"
3. create a new string that, considering the testvar contents above, would look like the following:
allocate channel c1 device type 'SBT_TAPE' rate 20M maxopenfiles 1 PARMS 'BLKSIZE=1048576, SBT_LIBRARY=<oracle_home>/lib/libddobk.so, ENV=(STORAGE_UNIT=emergo,BACKUP_HOST=USTSSSNSBRE024.sabre.com,ORACLE_HOME=<oracle_home>)' format 'df_%d_%I_<static_date_seq>_%U_%t%s%p';
Do not be concerned with the string beginning with PARMS, I can supply that no problem. The real objectives are items 1 and 2 - extract into a variable all up until the word 'disk' and then extract into another variable all after the word 'disk' and before the word 'format'.
Unfortunately I cannot just create a new line from scratch because there are thousands of these that will have to be converted and there are different options being used in the statement.
Any help will be much appreciated - thanks!