Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

substitution of dynamic regexp

Status
Not open for further replies.

shaleengarg

IS-IT--Management
Aug 5, 2003
2
US
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=&quot;\n&quot;; }
{
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
 
Try this:
Code:
matched=gsub(i,param)


Hope This Help
PH.
 
I have already tried that. It does not work either
 
And this:
Code:
matched=gsub(i,param[i])


Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top