ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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 have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
If done using a bash script, using programs such as xsltproc would be a better choice for manipulating xml files. That's what they are there for. Perl or Python xml libraries exist. Using bash probably isn't the best choice for dealing with complex XML files.
The OP should indicate the scripting language is being used. And I hope this isn't a homework problem.
It's pretty well-known that parsing things like XML or HTML with regular expressions is (1) hard, (2) error prone, (3) very liable to edge-case bugs, (4) often grossly inefficient. As a result, parsing via regular expressions is generally the wrong way to do it.
There are hundreds of well-made parsers for a variety of scripting and programming languages.
And yet, every time this comes up, people say the same things:
I know exactly what the data looks like, and there aren't nested or mal-formed tags
I just need to do this one thing quickly
You can do it with regular expressions (in many cases), so why not?
I tend to think regexes are not the best tool for the job, and there are lots of excellent, easily available tools. Better to use one of them.
Do you really expect to get people in discussion groups to write your programs for you, line by line?
Hey, I'm not going to say no to anyone who wants to write me the script. But I think ta0kira gave me enough information to accomplish this one thing quickly (... I sure hope there are no nested tags). But I'm here to learn and I appreciate Telemachos's warnings, so let me ask, what XML tools should I be using?
Originally Posted by jschiwal
And I hope this isn't a homework problem.
Not exactly. MS Word -- which I'm being forced to use -- corrupts .docx files under certain conditions too dull to describe here. This script will give me back my thesis.