LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-26-2009, 05:57 AM   #1
Rocket-boy
LQ Newbie
 
Registered: Oct 2009
Location: South Africa
Distribution: CentOS
Posts: 3

Rep: Reputation: 0
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.
 
Old 10-26-2009, 09:58 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,233

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
Quote:
Originally Posted by Rocket-boy View Post
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?
 
Old 10-27-2009, 12:44 AM   #3
Rocket-boy
LQ Newbie
 
Registered: Oct 2009
Location: South Africa
Distribution: CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
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?
 
Old 10-27-2009, 01:27 AM   #4
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 101Reputation: 101
Quote:
Originally Posted by Rocket-boy View Post
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.
 
Old 10-27-2009, 07:20 AM   #5
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,233

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
Quote:
Originally Posted by Rocket-boy View Post
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?
 
Old 10-28-2009, 12:48 AM   #6
Rocket-boy
LQ Newbie
 
Registered: Oct 2009
Location: South Africa
Distribution: CentOS
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by TB0ne View Post
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
 
Old 10-28-2009, 10:03 AM   #7
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,233

Rep: Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474Reputation: 2474
Quote:
Originally Posted by Rocket-boy View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk or sed to use CSV as input and XML as template and output to a single file bridrod Linux - Newbie 6 03-13-2012 07:00 PM
Create 1 csv file from multiple txt files richmur Programming 10 09-03-2008 01:28 PM
Combine output of multiple files in one CSV file say_hi_ravi Programming 4 07-17-2008 03:04 AM
Comparing two csv files and write different record in third CSV file irfanb146 Linux - Newbie 3 06-30-2008 09:15 PM
Adding Multiple Files In A Single Gz File onacorpuscle Linux - Newbie 3 08-31-2006 03:18 AM


All times are GMT -5. The time now is 08:10 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration