LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 08-30-2004, 02:13 PM   #1
anirudh
Member
 
Registered: Aug 2004
Location: bangalore india
Posts: 50

Rep: Reputation: 15
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
 
Old 08-30-2004, 02:31 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
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....
Code:
sed -e '1,$s|string1|string2|g' file1>>file2

Cheers,
Tink
 
Old 08-30-2004, 02:56 PM   #3
crabboy
Senior Member
 
Registered: Feb 2001
Location: Atlanta, GA
Distribution: Slackware
Posts: 1,821

Rep: Reputation: 121Reputation: 121
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.

http://www.linuxquestions.org/rules.php

Post in Programming:

http://www.linuxquestions.org/questi...hreadid=224408
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed command Kalyani1 Linux - Software 28 12-07-2005 11:48 AM
Require Linux/Perl equivalent command for windows Command alix123 Programming 7 08-19-2005 02:23 AM
sed command pazvant Linux - Software 2 05-09-2004 12:58 PM
sed Command linuxdev Linux - Newbie 3 02-09-2004 11:27 AM
sed command kwigibo Linux - General 3 04-21-2002 04:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration