-   Linux - Newbie (
-   -   require help for SED command (

anirudh 08-30-2004 02:13 PM

require help for SED command
i have to replace a very large xml string with another large xml string
i am using sed but it does not work can anybody help me fix my problem
i am using sed as sed -e '1,$s/string1/string2/g' file1>>file2

the string1=<defns:Party xmlns:defns="://url1" xmlns:soapenc="://url1" xmlns:xsd="url1" xmlns:wsdl="url1:///" xmlns:ns5="url1://" xmlns:ns4="http://url2" xmlns:ns3="://url4" xmlns:ns2="://url5" xmlns:ns1="://url5" xmlns:xsi="://url3">

string2(the string to replace string1)=
party xmlns:defns="://url1" xmlns:soapenc="://url2/" xmlns:xsd="://url3" xmlns:wsdl="://url3" xmlns:ns5="://url4" xmlns:ns4="://url5/" xmlns:ns3="://url6" xmlns:ns2="://url7" xmlns:ns1="://url8" xmlns:xsi="://url9" xsi:noNamespaceSchemaLocation="://url10">

plz help

Tinkster 08-30-2004 02:31 PM


sed -e '1,$s/string1/string2/g' file1>>file2
If you don't escape the // in the strings you may want to
use | as a separator for the sed command....

sed -e '1,$s|string1|string2|g' file1>>file2


crabboy 08-30-2004 02:56 PM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

Post in Programming:

All times are GMT -5. The time now is 11:40 AM.