Hi all,
I have a proplem when embed shell into C code by Sytem() command.
There is my code:
char acCommand[512];
acCommand[0] = '\0';
sprintf(acCommand,"sed \'s/\<UDN\>\<\/UDN>/\<UDN\>%s\<\/UDN\>\/g\' %s > %s", initParam.UDN, "/tmp/web/dmr.xml", "/tmp/web/dmr.xml.tmp");
printf("[%s]", acCommand);

and below is output after compiling:
sed 's/<UDN></UDN>/<UDN>uuid:b346ee95-93b3-4922-a132-cf72762b9318</UDN>/g' /tmp/web/dmr.xml > /tmp/web/dmr.xml.tmp]
sed: bad option in substitution expression
I thinks the bad option is <\/UDN\>
I have tried to do something but it still doesn't work, same as above problem.

Could you please help me to solve this problem.

Use ";" instead of "/" as the sed separators.
instead of




as that "/" in "</UDN>" is garbling your sed command.

I am going to try it now, thanks

great, many thank masijade.