I want to replace the values of $$SCHEMA_NAME , $$COL , $$TABLE_NAME, $$VALUE with the values mentioned in right ( i.e. test,DATETIME,table1,1234) in file a
if your SCHEMA_NAME is in the shell variable 'schema', you can use this:
sed -r -i -e 's/$$SCHEMA_NAME/'"$schema/" yourfile.xml
Watch out to see the quotings right!
you may use more than one Parameter -e 's/search/replace/' in one command.
The selection of $$IDENTIFIER is a bit harder to manage since $ is a special character which is used in the shell vor substituting variables. So it must be quoted properly to work. A better choice may be to use %%IDENTIFIER%%.
#!/bin/bash
# bash version 4 required
# associative array
declare -A AR
# read file into array
while IFS="=" read key val
do
AR[$key]=$val
done < FileB
# now process the main input file, IFS= = keep leading spaces
while IFS= read -r line
do
# cycle through each key
for key in "${!AR[@]}"
do
val=${AR[$key]}
# substitute key with value, // = globally = try many times
line=${line//$key/$val}
done
echo "$line"
done < FileA