Sponsored Content
Full Discussion: Best way to go about this?
Homework and Emergencies Emergency UNIX and Linux Support Best way to go about this? Post 302706909 by stevensw on Thursday 27th of September 2012 03:47:35 PM
Old 09-27-2012
Best way to go about this?

I am processing a very large file, which is a text csv report of a database.

I would like to parse this csv file into a bunch of XML files.

I am trying to decide the most efficient way to go about doing this.

Should I open all the XML files at the same time, and as I encounter data I write to whichever descriptor? This approach would only require iterating through the csv file once. But I would be maintaining a bunch of descriptors at the same time, is that efficient?

Should I open and close a descriptor each time I need to write a piece of information to one of the XML files? This approach would also only require iterating through the csv file once. But I would be constantly opening and closing descriptors.

Should I fill out each XML file one at a time, iterating through the whole csv file each time?

Help much appreciated.
 
Linux::Distribution::Packages(3pm)			User Contributed Perl Documentation			Linux::Distribution::Packages(3pm)

NAME
Linux::Distribution::Packages - list all packages on various Linux distributions SYNOPSIS
use Linux::Distribution::Packages qw(distribution_packages distribution_write); $linux = new Linux::Distribution::Packages({'format' => 'csv', 'output_file' => 'packages.csv'}); $linux->distribution_write(); # Or you can (re)set the options when you write. $linux->distribution_write({'format' => 'xml', 'output_file' => 'packages.xml'}); # If you want to reload the package data $linux->distribution_packages(); DESCRIPTION
This is a simple module that uses Linux::Distribution to guess the linux distribution and then uses the correct commands to list all the packages on the system and then output them in one of three formats: native, csv, and xml. Distributions currently working: debian, ubuntu, fedora, redhat, suse, gentoo, slackware, redflag. The module inherits from Linux::Distribution, so can also use its calls. EXPORT None by default. TODO
* Add the capability to correctly get packages for all recognized distributions. * Seperate out parsing from writing. Parse data to hash and give access to hash. Then write the formatted data from the hash. AUTHORS
Judith Lebzelter, <judith@osdl.org> Alberto Re, <alberto@accidia.net> COPYRIGHT AND LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.5 or, at your option, any later version of Perl 5 you may have available. perl v5.10.1 2006-04-19 Linux::Distribution::Packages(3pm)
All times are GMT -4. The time now is 05:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy