your doing something else as well
i copied your lines eactly as you showed them here.
and added testing info around them,
aaa {
set %ppp $1
echo -a :1: $+ %ppp $+ :
if ( $ isin %ppp ) { /set %ppp $replace(%ppp,$,04$01) }
if ( < isin %ppp ) { /set %ppp $replace(%ppp,<,12<01) }
echo -a :2: $+ %ppp $+ :
}
/aaa $$$$
:1:$$$$:
:2:04$0104$0104$0104$01:
/aaa <<<<<<
:1:<<<<<<:
:2:12<0112<0112<0112<0112<0112<01:
No Spaces appeared on my test at all.
one other thing u might consider doing, if those < & $ are altered all one after each other is this
set %ppp $replace(%ppp,$,04$01,<,12<01)
dump the isin and just replace any occurances, its faster as soon as your replacing more than one thing (this of course is dependent on if your script is ment to replace all of them in one bit of text)