This week's book giveaway is in the Testing forum.
We're giving away four copies of Practical Unit Testing with TestNG and Mockito and have Tomek Kaczanowski on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Shell Script Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Reply Bookmark "Shell Script" Watch "Shell Script" New topic
Author

Shell Script

vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
I want to write a shell script that will search for a string and replace it with another string. Is there any command in K shell that can do this operation. I need to replace http://xml.cxml.org/schemas/cXML/1.1.008/cXML.dtd"with a local file specification.
Thanks,
Vidhya.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
It depends a bit where you want to replace the string(s). The obvious choice is "sed" :-
sed 's$http://xml.cxml.org/schemas/cXML/1.1.008/cXML.dtd$whatever$g' <oldfile.xml >newfile.xml
should do the trick. Try "man sed" for more details. If that's not what you want, please let us know a few more details about the files you want to change, and maybe we can give a bit more help.
Grr. UBB ate my less-than
[ April 08, 2002: Message edited by: Frank Carver ]

A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
 
subject: Shell Script
 
Threads others viewed
HttpUrlConnection - cXML PunchOutSetupRequest
HttpURLConnection - Luanch Browser
Error Validating huge XSD with XML in a Servlet
Capture xmlfiles on website
XML data loading in Oracle tables.
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com