This change order issue is something what I was seeing how to solve in the printing when I do for(i in X), but I can't so far :wall:.
The other thing, I see now that I was testing with fixed format files format and not more general files as you show. Certainly it won't work
only with my simple test files:(. I'll try to adapt it in some other way if I can in order to work with other files:confused:
Your first code works fine with my test files, but the 2nd code prints the same file2, as below:
$ cat file1
$myName$|xxx
$yourName1$|xxy
$hisName$|zzz
$ cat file2
Your name is $yourName$
My name is $myName$
His name is $hisName$
$ awk -F\| 'NR==FNR{rep[$1]=$2; next;}
{ for(r in rep) gsub(r, rep[r],$0);
print $0 }' file1 file2
Your name is $yourName$
My name is $myName$
His name is $hisName$
Now the I need to read this config file and then I need to get the file in first column and need to find the value in second column in the file and then I need to replace it.
Please help me to write the snippet for this also please suggest some link to get the complete understanding about awk. I am beginner in UNIX
This is fantastic and awesome..... Chubler many thanks for you.......
Your assumption is perfect and this is what I want...
Finally one more kind request. I want to replace the values into files and I need to save the files with replaced values. Could you please help me in that......
Again Thanks for the snippet .....
---------- Post updated 04-07-11 at 10:11 AM ---------- Previous update was 04-06-11 at 08:03 PM ----------