Problem with sed and "F2..."

Hello,

i have following code lines in my ksh script:

find_str="TRENDROW|"$plaats"|"$lijn"|"
repl_str="TRENDROW|"$plaats"|"$lijn"|"$tag"|"$cbp"|"$ovl"|"$eu"|"$descr"|"

echo $find_str
echo $repl_str

sed "s/$find_str.*/$repl_str/g" trendtest.txt > trendtest_new.txt

where $tag looks something like L256, P785, F621, ...
So the $repl_str can look like:

TRENDROW|1|2|L235|REACTOR:L235.MEAS|ALMOVERLAY|%|REACTOR LEVEL|

now everything works fine, only when $tag equals something like F226 or F120 (so an F followed by a 1 or 2) i get an error stating "sed: garbage after command".
i know -f1 or -f2 is used if you want to pass a file as an argument, but here F2... is part of a string....

What can i do to make the script work for every value for $tag?

I don't have any problem with it, I've tried to reproduce the error with several values (F123, F212..) for $tag but I don't get any errors.

what i forgot to mention, i'm using MKS Toolkit to use unix scripts on a windows xp computer, maybe it's not 100% the same?
thanks for looking into it
dankje;)

That could probably the problem, but I don't have any experience with...
You can try it with awk but escape the pipe symbols in the find_st variable:

find_str="TRENDROW\|"$plaats"\|"$lijn"\|"
repl_str="TRENDROW|"$plaats"|"$lijn"|"$tag"|"$cbp"|"$ovl"|"$eu"|"$descr"|"

awk -v f="$find_str" -v r="$repl_str" '{sub(f,r)}1' trendtest.txt > trendtest_new.txt

10 points for Franklin52! It worked!:b:

(i just had to add an additional .* to $find_str in the awk command, like i did the sed command)

awk -v f="$find_str.*" -v r="$repl_str" '{sub(f,r)}1' trendtest.txt > trendtest_new.txt

I wasn't familiar with awk, but this is a good start to learn it. Thx.