Linux - NewbieThis 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!
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.
To explain it, every instance of "</Fine>\n" will be seen as a record separator, and each line inside that record is interpreted as a field. So for each record, print the fields in the order indicated, adding back the </Fine> at the end.
Last edited by David the H.; 06-10-2009 at 07:13 PM.
Reason: fixed minor mistake
for it in data:
for n,item in enumerate(it):
x = n
coady77: There are lots of great answers here, but since you haven't given any sample code of your own (towards a solution) nor any information on what you'd be comfortable with for this, then this may be out of your range; whether awk, python, perl or sed (or a few others not mentioned yet) if you're not able to even specify how you'd want this done, you'll probably not understand the solutions.
I'm not saying that to be nasty, but you're probably either better paying a contractor (if this is at work) or stepping back and putting this project at hold until you have a better idea (if this is for a personal project).
The fact of the matter is, a simple parser when you know the rules the file uses is a very, very quick job- like ghostdog74 demonstrated in python; I get the feeling you're not sure about this at all.
Last edited by jamescondron; 06-11-2009 at 12:14 AM.
Reason: spelling, eugh
save this XSLT to a file, then the easiest way to run the transformation on windows is to add an xml-stylesheet reference to the top of your XML file, then just open the XML file in IE and it will run the transformation and show the resulting output.
This is the line you would add to to your XML, right at the top
<?xml-stylesheet type="text/xsl" href="path/to/your.xsl"?>
<-- it goes here
I'm a bit puzzled why you need to rearrange it like this though, to any XML-aware application the order of nodes is irrelevant, its the hierarchy that's important.
Last edited by pg99; 06-11-2009 at 04:53 PM.
Reason: old version wasnt copying the ItemInfo node
Using an exe file came with the application A to extract data from its SQL DB -> produced an XML file ->
import XML file into another application B -> App B processed info and exports a txt file into App A
Well, app B merge <ItemTitle> and <ItemBarcode> into 1 field. However, this field only has max 50 characters. So, if <ItemTitle> has more than 50 characters, then <ItemBarcode> won't be in that field. Unfortunately the <ItemBarcode> is what app A people need.
So, I am just trying to manipulate the extract data hoping it would produce something that would satisfy what app A people want, while knowing asking App B vendor to add a field in their DB, or to increase the max characters would probably take months before I hear anything back from them.
So, I am more of a Windows/SQL person and sometimes need to use sed, awk, for and if for things like this.