I need to Remove String with special characters from a variable,
I have this string which is a path that I want to remove from a bigger path which I stored inside a variable.
So those are the parameters:
FULL_PATH=Server/.*/resources/schema/v12_55_6/.*/.*-dbSchemaDescriptor.xml,Server/.*/resources/SpringIOC/dataupgrader/v12_55_6/.*/.*-dataUpgrader.xml,Server/.*/java/com/company/mqm/dataupgrader/v12_55_6/.*/.*.java,Server/.*/resources/indexes/v12_55_6/.*.index,Server/.*/resources/schema/v12_55_7/.*/.*-dbSchemaDescriptor.xml,Server/.*/resources/SpringIOC/dataupgrader/v12_55_7/.*/.*-dataUpgrader.xml,Server/.*/java/com/company/mqm/dataupgrader/v12_55_7/.*/.*.java,Server/.*/resources/indexes/v12_55_7/.*.index,Server/.*/resources/schema/v12_55_8/.*/.*-dbSchemaDescriptor.xml,Server/.*/resources/SpringIOC/dataupgrader/v12_55_8/.*/.*-dataUpgrader.xml,Server/.*/java/com/company/mqm/dataupgrader/v12_55_8/.*/.*.java,Server/.*/resources/indexes/v12_55_8/.*.index
And this is the path(let's assume it's a string)that I want to remove from the variable:
REMOVE_PATH=Server/.*/resources/SpringIOC/dataupgrader/12_55_7/.*/.*-dataUpgrader\.xml,Server/.*/java/com/hp/mqm/dataupgrader/12_55_7,Server/.*/resources/indexes/12_55_7/.*\.index/.*/.*\.java
I tried to use shopt but it didn't do anything, This is the command I used:
shopt -s extglob;echo ${FULL_PATH//@($"{REMOVE_PATH}")}
*The FULL_PATH variable is something dynamic that can change so this is why I'm putting it inside a parameter.