Fast way of find and replace, help

Hi All,

I have nearly 200 files in a directory, each file is of nearly of 5000 lines.
Each line of each file is having its 3rd field to be replaced by corresponding replace_string(2nd field of file1.out below).

i.e.
-Search the 3rd field of each line of each of 200 files in file1.out, get the replace_string(2nd field of file1,out),
-replace that in each line(and in turn each file)

file1.out (is more than 5000 lines)
++++++++++++++++++++++++++++++++++++

1204675041      1204675051
1204675042      1204675063
1204675111      1204675142
1204675112      1204675154
1204675113      1204675166
1204675114      1204675177
1204675115      1204675189
1204675116      1204675200
<nearly 5000 more lines>
$ ls | while read FILE
> do
> awk -F "|" '{print $3}' $FILE | while read TIME
> do
> TORP=`awk '$1=="'"$TIME"'" {print $2}' file1.out`
> awk 'BEGIN{OFS=FS="|"} $3=="'"$TIME"'" {$3="'"$TORP"'"}{print}' $FILE > $FILE.tmp
> done
> done

I tried using bash with AWK to do the same(like above), the performance is not that good(its just hanging).

Could anyone suggest me a fast search and replace technique considering my scenario.

HTH,
jkl_jkl

awk 'NR == FNR { fld[$1] = $2; next }
FNR == 1 { close(fn); fn = FILENAME }
$3 in fld { $3 = fld[$3] }
{ print > fn }' file1.out 1_of_200 2_of_200 ... # or *

Use nawk or /usr/xpg4/bin/awk on Solaris.