Operating System - HP-UX
1831137 Members
2694 Online
110020 Solutions
New Discussion

Re: problem in sed script

 
Anand_30
Regular Advisor

problem in sed script

I have a sed script which I am using to change some lines in the program generated by rpcgen.
I want to change
(void) svc_sendreply(transp, xdr_void,
(char *)NULL);

to

(void) svc_sendreply(transp, (xdrproc_t)xdr_void,(char *)NULL);

How do I specify this in the sed script.
I have tried:

s/(void) svc_sendreply(transp, xdr_void,(char *)NULL) {/(void) svc_sendreply(tr
ansp, (xdrproc_t)xdr_void,(char *)NULL){/1

But not getting the desired result. Any help will be highly appreciated.

-Anand.

2 REPLIES 2
curt larson_1
Honored Contributor

Re: problem in sed script

first i'd try escaping special characters with a backslash, i.e. instead of *, use \*
Dave La Mar
Honored Contributor

Re: problem in sed script

Anand -
To add to Curt's response, I have found the need at times to single quote between eacho of the / / / i.e. s/'xyz'/'abc'/
another as suggested

s/\^M/'KO'/

Best of luck.

Regards,
dl
"I'm not dumb. I just have a command of thoroughly useless information."