shaleengarg
IS-IT--Management
All,
I am writing a simple program where I wish to substitute using gsub/sub function and a synamic regexp which is nothing but just a string. match function works but gsub does not find a match
following is the code snippet
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat c
BEGIN { FS=":";
while (( getline < paramfile ) >0 )
{
param[$1]=$2
}
FS="\n"; }
{
for (i in param)
{
if (match($0,i)!=0)
{
print param
matched=gsub(/i/,param)
print matched
}
}
}
END {
}
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat b
LOGMNR_TABLESPACE
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat param.txt
LOGMNR_TABLESPACE:FIMSPSSLM100
nawk -f c -v paramfile=param.txt b
I am writing a simple program where I wish to substitute using gsub/sub function and a synamic regexp which is nothing but just a string. match function works but gsub does not find a match
following is the code snippet
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat c
BEGIN { FS=":";
while (( getline < paramfile ) >0 )
{
param[$1]=$2
}
FS="\n"; }
{
for (i in param)
{
if (match($0,i)!=0)
{
print param
matched=gsub(/i/,param)
print matched
}
}
}
END {
}
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat b
LOGMNR_TABLESPACE
sbos10:/apps/oracle/admin/fssu1/scripts/s->cat param.txt
LOGMNR_TABLESPACE:FIMSPSSLM100
nawk -f c -v paramfile=param.txt b