For the below command I want to replace <tableName in Single Quotes> with each line from the above file.
Is there any way I could do this ? Expected output shown below
exec dbms_stats.gather_table_stats(ownname => 'SIEBEL', tabname => <tableName in Single Quotes> ,degree => 3, cascade => true );
while read tableName
do
echo "exec dbms_stats.gather_table_stats(ownname => 'SIEBEL', tabname => <tableName in Single Quotes> ,degree => 3, cascade => true );" | sed 's/<tableName in Single Quotes>/'"$tableName"'/'
done < pattern.txt
In fact, there's two s ubstitute operations, the ; separates the two. One ( s/^/.../ )substitutes the begin-of-line, the other ( s/$/.../ ) the end-of-line.
Explanation: create s1 variable with value exec dbms_stats.gather_table_stats(ownname => 'SIEBEL', tabname => , create 2nd variable named s2 with value ,degree => 3, cascade => true ); and then simply print value of s1 then $0 (current line) and value of s2 .