suggest
marketing
Perl script to create csv files with a pattern – Generic script.
Hot:sun Perl script to create csv files with a pattern   Generic script.sun dark Perl script to create csv files with a pattern   Generic script.sun dark Perl script to create csv files with a pattern   Generic script.sun dark Perl script to create csv files with a pattern   Generic script.sun dark Perl script to create csv files with a pattern   Generic script.

I was having a really bad day and needed a quick solution to create some csv files. And this I needed to do for multiple data kinds and patterns, so I created this small script to do the job for me…

#Number of rows required in the output.

$rows = 100;

#The config and the output file

open (CF_FILE, “<Config.test”);
open (OUT_FILE, “>test.csv”);

#—————————————————————————
# No need to change anything below this.
#—————————————————————————

$count = 0 ;

#read a line from config file of the type

#also any line starting with # is treated as comment.

# startingvalue incrementvalue

# so you can have any number of fields here and all of them you would be joined with , to write to the output file.
while (<CF_FILE>)
{
/^#/ && next;
chomp();
@vars = split(/ /);
$arr[$count] = $vars[0];
$arr_inc[$count] = $vars[1];
$count++;
}
for ($i=0; $i < $rows; $i++)
{
$line = join (“,”,@arr);
print OUT_FILE “$linen”;
for ($j=0; $j < $count; $j++)
{
$arr[$j] += $arr_inc[$j];
}
}

 Perl script to create csv files with a pattern   Generic script.amit-agarwal.co.in/wp-content/uploads/2010/08/reblog_b5.png" alt="Reblog this post [with Zemanta]" />
jobs Perl script to create csv files with a pattern   Generic script.
Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • Blogosphere News
  • co.mments
  • HelloTxt
  • Ping.fm
  • Reddit
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • BlinkList
  • Diigo
  • email
  • Identi.ca
  • LinkedIn
  • Live
  • MyShare
  • MySpace
  • PDF
  • SheToldMe
  • Slashdot
  • Socialogs
  • Tumblr

related post

CBA0E3ABEB1A7038A3FD2A47BA03BC1B Perl script to create csv files with a pattern   Generic script.

Technorati Tags: Configuration file, Data Formats, File Management, File Managers, Languages, perl, programming, Windows

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Trackbacks/Pings

  1. Perl script to create csv files with a pattern – Generic script … | Drakz Free Online Service Jan 19 2010 at 4pm:

    [...] link: Perl script to create csv files with a pattern – Generic script … Share and [...]

  2. Perl script to create csv files with a pattern – Generic script … | Drakz Free Online Service Jan 24 2010 at 5pm:

    [...] this article: Perl script to create csv files with a pattern – Generic script … Share and [...]

  3. Perl script to create csv files with a pattern – Generic script … | Drakz Free Online Service Jan 24 2010 at 5pm:

    [...] Perl script to create csv files with a pattern – Generic script … Share and [...]

  4. What if I duplicate the Meta Keywords tag? | Getpoint Jan 28 2010 at 4pm:

    [...] Perl script to create csv files with a pattern – Generic script. [...]

Leave a reply
e-mail

Back to top