ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you want to pursue the first usage, you will have to open and overwrite the file yourself. If you want to use the second usage, just put the entire command as an argument to system.
Distribution: Redhat, Fedora, Centos, Ubuntu, Debian, Solaris
Posts: 15
Original Poster
Rep:
As for the first one, well, I actually don't really know how to do that. Did some googling, found a few sample scripts, but they didn't work for me.
As for the second, I tried it and it worked ( with simple replacements ), but i don't know how to pass a variable from shell (sh) to perl command ( it didn't work when I just placed the whole string in the command line )
Perl has many CPAN-modules for manipulating XML. These include libraries specifically designed to do XML search-and-replace, e.g. through XPath-expressions.
Check out, for example, XML::Twig.
A CPAN-search for XML will produce a huge number of entries. This is a great example of a situation where "automatically dropping into procedural-programming mode... 'how do I write a program to do this?'" will instantly be the wrong approach. The answer is "you don't." The program has already been written. Searching through and transforming an XML structure can be done declaratively, using the facilities provided by the CPAN modules.
Distribution: Redhat, Fedora, Centos, Ubuntu, Debian, Solaris
Posts: 15
Original Poster
Rep:
Problem is that i don't have control over modules installed on the server and there are no xml related modules already installed.
Also, time is an issue here as well.
I just need to replace one with the other, and sed is throwing errors about suffix larger than 512
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.