I amfacing an error working with sed on files.
We have this core running successfully on OracleLinux 7.9 but onOracleLinux 8.9 the same code fails with invalid range end
sed -r -f ./sed/transform-diff.sed < 15-diffToUpdate.xml > 15-diffToUpdate.xml.tmp
sed: file ./sed/transform-diff.sed line 11: Invalid range end
where transform-diff-sed is:
# sed script to transform generated Liquibase diff file
# Problem to solve: If a column is dropped, a RDBM drops as well every index, that uses these columns. In the
# Liquibase diff script, columns are dropped first, indexes later. In the previously described case, an index
# might already be deleted and the update might fail.
# Solution: Put every <dropIndex> in a separate <changeSet>, containing a <indexExists> preCondition that
# only executes the <dropIndex> if it still exists.
/<changeSet/ {
N
s%([ t]*)<changeSet author="([a-zA-Z ()]*)" id="([a-zA-Z0-9-]*)">[ tn]*(<dropIndex indexName="([a-zA-Z0-9_]*)"[a-zA-Z_-=" ]*>)%1<changeSet author="2" id="3a">n11<preConditions onFail="CONTINUE">n111<indexExists indexName="5" />n11</preConditions>n114n1</changeSet>n1<changeSet author="2" id="3b">%g
}
# Problem to solve: Liquibase diff reads from type FLOAT not the precision but the the required bytes adds
# this information to its change log. A FLOAT (with default precision of 126) is transformed to a FLOAT(22),
# which is too short. By removing all precision information in the generated diff file, we avoid this
# problem.
/type="FLOAT(/ {
s%type="FLOAT([0-9]*)"%type="FLOAT"%g
}
Any hints how to proceed ? The sed commands were developed years ago and could been changed. I do need to get it running
I isolated the code and get it running on two seperate machines
1.) Oracle Linux 7.9 –> works fine, Output-File is filled
2.) Oracle Linux 8.9 –> error message, Output-File is empty
tia
Uwe
2
seemslike our internal AI helped to solve the error – so this must been a difference between the Versions ofsed in 7.9 and 8.9
Functioning code is:
s%([ t]*)<changeSet author="([a-zA-Z ()]*)" id="([a-zA-Z0-9-]*)">s*(<dropIndex indexName="([a-zA-Z0-9_]*)"[^>]*>)%1<changeSet author="2" id="3a">n11<preConditions onFail="CONTINUE">n111<indexExists indexName="5" />n11</preConditions>n114n1</changeSet>n1<changeSet author="2" id="3b">%g