LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   looking for software to convert multiple csv files to a single xml file (https://www.linuxquestions.org/questions/linux-software-2/looking-for-software-to-convert-multiple-csv-files-to-a-single-xml-file-764499/)

Rocket-boy 10-26-2009 05:57 AM

looking for software to convert multiple csv files to a single xml file
 
Does anyone know of any software that will convert a few csv's into a single xml?
I have a windows program that has been doing it up until now but the info is pulled from one of my linux servers and then sent back to it afterwards, im looking to script it all rather and keep everything on the linux box.

TB0ne 10-26-2009 09:58 AM

Quote:

Originally Posted by Rocket-boy (Post 3732721)
Does anyone know of any software that will convert a few csv's into a single xml?
I have a windows program that has been doing it up until now but the info is pulled from one of my linux servers and then sent back to it afterwards, im looking to script it all rather and keep everything on the linux box.

Well, you've got Perl available to you on Linux. Wouldn't take much to write a Perl program to do it...perl's got XML modules available for it, and you can tailor it to suit you.

Google also returns lots...including a csv2xml program:
http://csv2xml.sourceforge.net/

Did you look there first?

Rocket-boy 10-27-2009 12:44 AM

Quote:

Originally Posted by TB0ne (Post 3732920)
Well, you've got Perl available to you on Linux. Wouldn't take much to write a Perl program to do it...perl's got XML modules available for it, and you can tailor it to suit you.

Google also returns lots...including a csv2xml program:
http://csv2xml.sourceforge.net/

Did you look there first?

Thanks for the reply TBone,
I have checked that one out, it only takes a single input file at a time and ends up overwriting the file if try to write to it multiple times.
I was trying to avoid perl because i dont know it at all. Im very used to bash scripting but perl is new to me.
Maybe I should post something in the programming threads?

lutusp 10-27-2009 01:27 AM

Quote:

Originally Posted by Rocket-boy (Post 3733711)
Maybe I should post something in the programming threads?

Maybe it's time to learn how to write computer programs. What you are doing now is called "programming by newsgroup". It is to programming what "suicide by police" is to interpersonal dynamics.

TB0ne 10-27-2009 07:20 AM

Quote:

Originally Posted by Rocket-boy (Post 3733711)
Thanks for the reply TBone,
I have checked that one out, it only takes a single input file at a time and ends up overwriting the file if try to write to it multiple times.
I was trying to avoid perl because i dont know it at all. Im very used to bash scripting but perl is new to me.
Maybe I should post something in the programming threads?

Well, since you're used to bash scripting, why not write a bash script to loop through all the file(s) you want, convert, and rename them, and use the csv2xml tool as just another utility in the bash script?

Rocket-boy 10-28-2009 12:48 AM

Quote:

Originally Posted by TB0ne (Post 3734017)
Well, since you're used to bash scripting, why not write a bash script to loop through all the file(s) you want, convert, and rename them, and use the csv2xml tool as just another utility in the bash script?

Thats not a bad idea at all.
I used to write C++ code so maybe its time to look into Perl. The only problem is that I would use it so seldom that its almost not worth learning :(

TB0ne 10-28-2009 10:03 AM

Quote:

Originally Posted by Rocket-boy (Post 3734919)
Thats not a bad idea at all.
I used to write C++ code so maybe its time to look into Perl. The only problem is that I would use it so seldom that its almost not worth learning :(

You'd be surprised...I used to write EVERYTHING in C/C++, until I learned Perl. The flexibility, portability, and modules to handle LOTS of different things, makes it hard to go back.


All times are GMT -5. The time now is 01:18 PM.