Perl DBI upload a csv file to Access database

2012-06-27 Thread Yu-Shan Wang
I try to upload a csv file to access database using perl DBI. But keep failing. The* number* and *type* of the field in csv file are not fixed. Might be integer or character. ( I was able to make it if they are fixed) ---start of code #connect

Re: Need to use csv file header instead of index.

2010-12-02 Thread Brian Fraser
How would you do this in Ruby, then? I work in Ruby myself, and it's generally quite simple to translate from one language to the other. If you just want to be able to say $columns[Name] instead if $columns[5], it's just as simple as saying my $Name = 5; $columns[$Name]; Or, if you hold some

Need to use csv file header instead of index.

2010-12-01 Thread meaculpa
I have a csv file, and iam checking for a condition like : if (@columns=parse_csv($_)) { #print $columns[11].__\n; if($columns[11] =~ m/$field/i $columns[12] ge $\rating ) { writeLog(Name: $columns[5] \n\t Rating: $columns[12]\n); OpenCv($columns[5]); Instead

Re: Need to use csv file header instead of index.

2010-12-01 Thread Shlomi Fish
Hi meaculpa, On Wednesday 01 December 2010 09:25:43 meaculpa wrote: I have a csv file, and iam checking for a condition like : if (@columns=parse_csv($_)) { #print $columns[11].__\n; if($columns[11] =~ m/$field/i $columns[12] ge $\rating ) { writeLog(Name: $columns

Re: Need to use csv file header instead of index.

2010-12-01 Thread Shlomi Fish
Hi meaculpa, please reply to the list as I specifically requested in my signature. On Wednesday 01 December 2010 12:10:20 meaculpa wrote: here what i am using is it fetch the class which is given from column 11 and match with the age of students with column 12 and output the name from column

Re: Need to use csv file header instead of index.

2010-12-01 Thread meaculpa
here what i am using is it fetch the class which is given from column 11 and match with the age of students with column 12 and output the name from column 5. So how this code will make it work. Will be helpful if given a detaled reply as I am new to perl and need to submit it by today. -- To

Re: Need to use csv file header instead of index.

2010-12-01 Thread meaculpa
No No, this is not an assignment and iam not a college student. I am a professional and this is for automation using data driven. I have experiencce in Ruby but not perl. Please help -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail:

Re: Need to use csv file header instead of index.

2010-12-01 Thread meaculpa
On Dec 1, 3:27 pm, shlo...@iglu.org.il (Shlomi Fish) wrote: Hi meaculpa, please reply to the list as I specifically requested in my signature. On Wednesday 01 December 2010 12:10:20 meaculpa wrote: here what i am using is it fetch the class which is given from column 11 and match with

Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Lauri Nikkinen
Hello, I would like to parse a .csv file and write certain records into two separate files. The program below writes the records easily into the csvtmp.csv but the second file is only created with no records written. I cannot see the problem here, the second file is produced easily if the first

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Lauri Nikkinen
OUTFILE2; close $fh; #== 2008/11/18 Raymond Wan [EMAIL PROTECTED]: Hi Lauri, Lauri Nikkinen wrote: I would like to parse a .csv file and write certain records into two separate files. The program below writes the records easily into the csvtmp.csv but the second

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Raymond Wan
$csv_line-{'Surname'} . : . $csv_line-{'Company'} . \n; } } close OUTFILE; close OUTFILE2; close $fh; #== 2008/11/18 Raymond Wan [EMAIL PROTECTED]: Hi Lauri, Lauri Nikkinen wrote: I would like to parse a .csv file and write certain records into two separate

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Chas. Owens
On Tue, Nov 18, 2008 at 09:53, Lauri Nikkinen [EMAIL PROTECTED] wrote: snip #Read the data into an array my @data = $fh; snip This will only work so long as the file can be fit into memory, and even then, if the file is large enough, it can have a noticeable impact on system performance. If

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Chas. Owens
On Tue, Nov 18, 2008 at 10:05, Raymond Wan [EMAIL PROTECTED] wrote: Hi Lauri, Good to hear -- if the file is small enough to be read in entirely, that is what I would do. If you need to add in another loop to output a third file, then you can just add it in easily to make another pass.

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Raymond Wan
Hi Chas., Chas. Owens wrote: On Tue, Nov 18, 2008 at 10:05, Raymond Wan [EMAIL PROTECTED] wrote: Hi Lauri, Good to hear -- if the file is small enough to be read in entirely, that is what I would do. If you need to add in another loop to output a third file, then you can just add it in

Re: Problem with parsing csv file and writing into two separate files

2008-11-18 Thread Mr. Shawn H. Corey
On Tue, 2008-11-18 at 10:16 -0500, Chas. Owens wrote: Perl closes all file handles at the end of the program, so the only reasons to close file handles early are 1. the program doesn't end (it is a daemon) 2. you have a limited number of file handles in your environment (or you consume an

Problem with parsing csv file and writing into two separate files

2008-11-17 Thread Lauri Nikkinen
Hello, I would like to parse a .csv file and write certain records into two separate files. The program below writes the records easily into the csvtmp.csv but the second file is only created with no records written. I cannot see the problem here, the second file is produced easily if the first

Re: Problem with parsing csv file and writing into two separate files

2008-11-17 Thread Raymond Wan
Hi Lauri, Lauri Nikkinen wrote: I would like to parse a .csv file and write certain records into two separate files. The program below writes the records easily into the csvtmp.csv but the second file is only created with no records written. I cannot see the problem here, the second file

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-07-08 Thread perez . erasmo
Hi dear Rob and friends from the list: Thank you very much for your great help. The code is now running flawlessly :-) Thank you very much for your time and shared knowledge Will try to give back a little bit of the much help received in this great community Kind regards Erasmo On

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-07-05 Thread Rob Dixon
[EMAIL PROTECTED] wrote: I have discovered that the number between square brackets [] won't be only a one-digit number, but now it can contain an un-foreseen number of digits, because the number inside the square brackets will grow from 1 to several millions As I have just stated, with a

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-07-04 Thread perez . erasmo
33 34 } and I need to tranform it in a new CSV file that starts each line with the cluster value (the square-brackets enclosed value), followed by its {}-bracket enclosed list values (in the same order), as is shown below: 1,2,3,4,8,10,14 2,25,26,29,32 3,1,5,6,7,11,12,13,17,18,22

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-07-04 Thread perez . erasmo
much indeed :-) Now, my last (I hope) issue. I got another text file in the following format: cluster[1] = { 2 3 4 8 10 14 } cluster[2] = { 25 26 29 32 } cluster[3] = { 1 5 6 7 11 12 13 17 18 22 } cluster[4] = { 9 19 21 23 24 27 28 30 31 33 34 } and I need to tranform it in a new CSV file

How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread Erasmo Perez
Hi dear list: Please forgive my lack of Perl credentials, but i am a complete beginner But, and that is the problem, I do have an urgent issue and that's why I came to perl in the very first instance I have a CSV file, which comes in the following format: a,b,.,.,.,.,.,.,. b,c,d,.,.,.,.,.,. e

Re: How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread Jeff Peng
On Fri, Jun 27, 2008 at 12:26 AM, Erasmo Perez [EMAIL PROTECTED] wrote: a,b,.,.,.,.,.,.,. b,c,d,.,.,.,.,.,. e,f,g,h,.,.,.,.,. i,j,k,l,m,.,.,.,. and so on My problem: how could I get rid of the trailing points and commas, so the output CSV file could get following neat format (without

Re: How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread perez . erasmo
Hi dear Jeff: Thank you very much for your help Yiur script is working flawlessly Just another question: How could I re-write your script in order to treat the __DATA__ portion of your code as an external file ? I happen to have the whole CSV file and I would not want to mix directly

Re: How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread yitzle
to have the whole CSV file and I would not want to mix directly with it, but to reference it from the perl code How could I accomplish that ? Should I substitue the DATA for the name of the CSV file in the perl code ? Thank you very much for any help Regards Erasmo Replace: while(DATA

Re: How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread perez . erasmo
Hi dear Yitzle: Thank you very much for you suggestion about the sustitution of the code, required to treat separately the CSV file (from the perl code). It has worked flawlessly :-) Thank you (all) very much Regards On 26/06/2008, yitzle [EMAIL PROTECTED] wrote: On Thu, Jun 26, 2008 at 1:14

How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread Erasmo Perez
] = { 25 26 29 32 } cluster[3] = { 1 5 6 7 11 12 13 17 18 22 } cluster[4] = { 9 19 21 23 24 27 28 30 31 33 34 } and I need to tranform it in a new CSV file that starts each line with the cluster value (the square-brackets enclosed value), followed by its {}-bracket enclosed list values (in the same order

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread yitzle
file in the following format: cluster[1] = { 2 3 4 8 10 14 } cluster[2] = { 25 26 29 32 } cluster[3] = { 1 5 6 7 11 12 13 17 18 22 } cluster[4] = { 9 19 21 23 24 27 28 30 31 33 34 } and I need to tranform it in a new CSV file that starts each line with the cluster value (the square-brackets

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread perez . erasmo
in the following format: cluster[1] = { 2 3 4 8 10 14 } cluster[2] = { 25 26 29 32 } cluster[3] = { 1 5 6 7 11 12 13 17 18 22 } cluster[4] = { 9 19 21 23 24 27 28 30 31 33 34 } and I need to tranform it in a new CSV file that starts each line with the cluster value (the square-brackets enclosed value

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread yitzle
On Thu, Jun 26, 2008 at 5:22 PM, [EMAIL PROTECTED] wrote: Hi Yitzle: Thank you very much for your suggestion: Here is my perl file: clusters.pl #! /usr/bin/perl use warnings; use strict; while (my $line = ) { $line = ~/cluster\[(\d)+\] = {([\d ]+)}/ or die; my @vals = split(/+/,$1

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread perez . erasmo
Hi dear Yitzle: Thank you very much for your great help :-) Your perl code works great ! The problem was indeed from my side, since I was over-confident in the (mis)use of blank space (a beginner sin) But now your code works, thank to your helpful replies and I now i got my a... neck covered

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread Dr.Ruud
yitzle schreef: while ( my $line = ) { $line =~ /cluster\[(\d)+\] = {([\d ]+)}/ or die; my @vals = split( / +/, $1 $2 ); print join(,, @vals) . \n; } Less strict alternative: while () { my @vals = /([0-9]+)/g or die; print join(,, @vals) . \n; } or even: {

Re: How to remove trailing commas and points from a CSV file ?

2008-06-26 Thread John W. Krahn
Erasmo Perez wrote: Hi dear list: Hello, Please forgive my lack of Perl credentials, but i am a complete beginner But, and that is the problem, I do have an urgent issue and that's why I came to perl in the very first instance I have a CSV file, which comes in the following format: a,b

Re: How to remove [], {}, and other characters, rendering numeric values in a CSV file ?

2008-06-26 Thread John W. Krahn
] = { 2 3 4 8 10 14 } cluster[2] = { 25 26 29 32 } cluster[3] = { 1 5 6 7 11 12 13 17 18 22 } cluster[4] = { 9 19 21 23 24 27 28 30 31 33 34 } and I need to tranform it in a new CSV file that starts each line with the cluster value (the square-brackets enclosed value), followed by its {}-bracket enclosed

Re: Removing special character from first line in CSV file

2008-06-18 Thread Dr.Ruud
suyog_linux schreef: I am new to perl coding and I am working with a CSV file where I have to remove all the double quotes () from the first line of the file. I need a code that I can embed in a .pl file. Could somebody help me with this ? Consider Text::CSV_XS -- Affijn, Ruud Gewoon

Removing special character from first line in CSV file

2008-06-17 Thread suyog_linux
Hi All, I am new to perl coding and I am working with a CSV file where I have to remove all the double quotes () from the first line of the file. I need a code that I can embed in a .pl file. Could somebody help me with this ? Thanks, Suyog -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: Removing special character from first line in CSV file

2008-06-17 Thread Dermot
2008/6/17 suyog_linux [EMAIL PROTECTED]: Hi All, Hi, I am new to perl coding and I am working with a CSV file where I have to remove all the double quotes () from the first line of the file. Could you send us what you've tried so far. It works better if we can see what you've tried and point

Re: csv file question

2008-05-10 Thread perl pra
}++; } foreach my $key (keys %has) { print $key is $has{$key} times\n; } On 5/6/08, Anirban Adhikary [EMAIL PROTECTED] wrote: Dear list I have a csv file having the following contents. col1 col2 col3 A, 1,2 B,1, 3 C,2,4 D,1,5 A,1,6 B,2,7 C,2,8 ,3,9 Now I want to implement a logic

csv file question

2008-05-06 Thread Anirban Adhikary
Dear list I have a csv file having the following contents. col1 col2 col3 A, 1,2 B,1, 3 C,2,4 D,1,5 A,1,6 B,2,7 C,2,8 ,3,9 Now I want to implement a logic which will show me the summarize records as follows col1 count A- 2 B - 2 C - 2 D - 1 and one more question how the null value

Re: csv file question

2008-05-06 Thread yitzle
I'm sure someone more experienced will have a far more elegant solution, but something along these lines might work. (Note: code untested) %count; while () { if ($_ =~ /^([^]*)/) { %count{$1}++; } } for (keys %count) { print $_ - $count{$_}\n; } or, refractored, %count; while () {

Re: csv file question

2008-05-06 Thread Gunnar Hjalmarsson
Anirban Adhikary wrote: I have a csv file having the following contents. col1 col2 col3 A, 1,2 B,1, 3 C,2,4 D,1,5 A,1,6 B,2,7 C,2,8 ,3,9 Now I want to implement a logic which will show me the summarize records as follows col1 count A- 2 B - 2 C - 2 D - 1 my %cnt; /^(\w

Re: delete columns csv file

2008-04-03 Thread e-letter
moved to the next line and remained, flashing without the [...] prefix. I pressed crtl c and looked at the file using mc. The result was that my csv file was totally emptied of content, i.e. became an empty file. So I went to search for the text::csv module. I tried to check if this was installed

Re: delete columns csv file

2008-04-03 Thread John W. Krahn
to the next line and remained, flashing without the [...] prefix. I pressed crtl c and looked at the file using mc. The result was that my csv file was totally emptied of content, i.e. became an empty file. At this point you could have restored the original file by moving the back-up file

Re: delete columns csv file

2008-04-03 Thread Rob Dixon
e-letter wrote: Readers, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: if column headerx contains

delete columns csv file

2008-04-02 Thread e-letter
Readers, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: if column headerx contains only values of 0.0e0, delete

Re: delete columns csv file

2008-04-02 Thread Rob Dixon
e-letter wrote: I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: if column headerx contains only values

Re: delete columns csv file

2008-04-02 Thread John W. Krahn
e-letter wrote: Readers, Hello, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform: if column headerx contains

Re: delete columns csv file

2008-04-02 Thread John W. Krahn
John W. Krahn wrote: e-letter wrote: Readers, Hello, I have a csv file (greater than 256 columns hence unable to open in spreadsheet) of the following format: column header1, column header2, column header3 1,0.0e0,0.0e0,5e-6 2,0.0e0,0.0e0,6e-7 3,0.0e0,0.0e0,0.0e0 I want to perform

CSV file

2007-09-21 Thread manojkumarg
There is a report that is generated from a script as a plain text file. I need to take this output file as input for my script and join them and create a CSV file and mail to me daily. How can I create CSV file with out using modules. Taking a sample report Hostname IP address

Re: CSV file

2007-09-21 Thread Ken Foskey
On Fri, 2007-09-21 at 15:50 +0500, [EMAIL PROTECTED] wrote: There is a report that is generated from a script as a plain text file. I need to take this output file as input for my script and join them and create a CSV file and mail to me daily. How can I create CSV file with out using

Re: CSV file

2007-09-21 Thread Chas. Owens
(',', map { s///g; qq($_) } @fields), \n; snip Also I need to bold the header in my CSV. snip CSV is a plain text format, there is no way to bold anything. If you are using the CSV file solely to get the data into MS Excel and you want to be able to control the style of the document then HTML

Re: CSV file

2007-09-21 Thread Jonathan Lang
On 9/21/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: There is a report that is generated from a script as a plain text file. I need to take this output file as input for my script and join them and create a CSV file and mail to me daily. How can I create CSV file with out using modules

Re: CSV file

2007-09-21 Thread John W. Krahn
Ken Foskey wrote: On Fri, 2007-09-21 at 15:50 +0500, [EMAIL PROTECTED] wrote: There is a report that is generated from a script as a plain text file. I need to take this output file as input for my script and join them and create a CSV file and mail to me daily. How can I create CSV file

Re: parsing csv-file for inserting in database

2007-09-19 Thread Ruprecht Helms
Hi, On running the script I get the following errors: Scalar found where operator expected at ./csv_auslesen.pl line 29, near pint Auftrag $Datenfelder (Might be a runaway multi-line string starting on line 3) (Do you need to predeclare pint?) Backslash found where operator expected

RE: parsing csv-file for inserting in database

2007-09-19 Thread Andrew Curry
open(CSV,Kalkulation_Tauchsportportal.csv) || die CSV-Datei nicht gefunden\; you have \ your -Original Message- From: Ruprecht Helms [mailto:[EMAIL PROTECTED] Sent: 19 September 2007 10:40 To: Chas Owens Cc: Jonathan Lang; beginners@perl.org Subject: Re: parsing csv-file for inserting

RE: parsing csv-file for inserting in database

2007-09-19 Thread Andrew Curry
@Datenfelder = split(/,,,$Felder); Guessing this line. Split (//,$string) -Original Message- From: Ruprecht Helms [mailto:[EMAIL PROTECTED] Sent: 19 September 2007 15:00 To: Andrew Curry Cc: Chas Owens; Jonathan Lang; beginners@perl.org Subject: Re: parsing csv-file for inserting

Re: parsing csv-file for inserting in database

2007-09-19 Thread Ruprecht Helms
Andrew Curry wrote: open(CSV,Kalkulation_Tauchsportportal.csv) || die CSV-Datei nicht gefunden\; you have \ your Ok I corrected it, now I only have an syntax-error in line 25 (split-command). In addition i am told that the part is not terminated. The actual code is: #!/usr/bin/perl

Re: parsing csv-file for inserting in database

2007-09-19 Thread Chas Owens
Auftrag. $i++; } } close (Auftrag); print $Anzahl, Datensaetze geschrieben\n; Your code is better written as #!/usr/bin/perl use strict; use warnings; my $file = Kalkulation_Tauchsportportal.csv; open my $csv, '', $file or die could not open ${file}:$!\n

Re: parsing csv-file for inserting in database

2007-09-19 Thread Ruprecht Helms
Chas Owens wrote: On 9/19/07, Ruprecht Helms [EMAIL PROTECTED] wrote: #!/usr/bin/perl First off, you should use the strict and warnings pragmas. So the first two lines after the $! should be use strict; use warnings; ... I inserted the two commands and get now these errors. Scalar

Re: parsing csv-file for inserting in database

2007-09-19 Thread Chas Owens
On 9/19/07, Ruprecht Helms [EMAIL PROTECTED] wrote: Chas Owens wrote: On 9/19/07, Ruprecht Helms [EMAIL PROTECTED] wrote: #!/usr/bin/perl First off, you should use the strict and warnings pragmas. So the first two lines after the $! should be use strict; use warnings; ... I

Re: parsing csv-file for inserting in database

2007-09-17 Thread Chas Owens
On 9/16/07, Ruprecht Helms [EMAIL PROTECTED] wrote: Hi, how can I parse a csv-file where the entries are seperated with | . The scripts later should put them into a mysql-database using dbi. Especially for me is interessting how to parse the content of the file and store them

Re: parsing csv-file for inserting in database

2007-09-17 Thread Jonathan Lang
Ruprecht Helms wrote: Hi, how can I parse a csv-file where the entries are seperated with | . The scripts later should put them into a mysql-database using dbi. Especially for me is interessting how to parse the content of the file and store them into different variables for later

Re: parsing csv-file for inserting in database

2007-09-17 Thread Chas Owens
On 9/17/07, Jonathan Lang [EMAIL PROTECTED] wrote: snip Most of the replies have suggested using 'split( /\|/, $line )'. However, this ignores a potentially important aspect of common cvs file formats - well, important to me, anyway - which is the interaction between quotes, field delimiters,

Re: parsing csv-file for inserting in database

2007-09-17 Thread Ken Foskey
On Mon, 2007-09-17 at 13:34 -0700, Jonathan Lang wrote: Most of the replies have suggested using 'split( /\|/, $line )'. However, this ignores a potentially important aspect of common cvs file formats - well, important to me, anyway - which is the interaction between quotes, field delimiters,

parsing csv-file for inserting in database

2007-09-16 Thread Ruprecht Helms
Hi, how can I parse a csv-file where the entries are seperated with | . The scripts later should put them into a mysql-database using dbi. Especially for me is interessting how to parse the content of the file and store them into different variables for later processing. A scriptexample would

Re: parsing csv-file for inserting in database

2007-09-16 Thread Ken Foskey
On Sun, 2007-09-16 at 12:28 +0200, Ruprecht Helms wrote: Hi, how can I parse a csv-file where the entries are seperated with | . The scripts later should put them into a mysql-database using dbi. if it just splitting: @data = split( /\|/, $line ); If you forget the backslash

Re: parsing csv-file for inserting in database

2007-09-16 Thread Ruprecht Helms
Hi Ken, how can I parse a csv-file where the entries are seperated with | . The scripts later should put them into a mysql-database using dbi. if it just splitting: @data = split( /\|/, $line ); I see you are working with array. The using of the for each-loop must be possible

Re: manipulating csv file fields through perl

2007-08-28 Thread oryann9
have a working example of inserting, deleting and substituting data in cells? In the doc it states: $dbh-do(UPDATE $table SET id = 3 WHERE id = 1); and $dbh-do(DELETE FROM $table WHERE id 1); Would $table be the name of the csv file? thank you

Re: manipulating csv file fields through perl

2007-08-28 Thread Lawrence Statton
be the name of the csv file? That is the default behavior, however ... $dbh-{'csv_tables'}-{'SomeName'} = { 'file' = 'SomeName20070827.csv'}; # tie the table name to the filename ... here you can see they are mapping a table SomeName to the file SomeName20070827.csv -- Lawrence

Re: manipulating csv file fields through perl

2007-08-28 Thread oryann9
); and $dbh-do(DELETE FROM $table WHERE id 1); Would $table be the name of the csv file? Lawrence Thank you for replying but since I am trying to learn your response did not help much. :( Any add'l help? Anyway here is what I have tried: #!/usr/bin/perl use strict; use warnings

Re: manipulating csv file fields through perl

2007-08-28 Thread Chas Owens
On 8/28/07, oryann9 [EMAIL PROTECTED] wrote: snip Thank you for replying but since I am trying to learn your response did not help much. :( Any add'l help? snip #!/usr/bin/perl use strict; use warnings; use DBI; my $dbh = DBI-connect( 'DBI:CSV:f_dir=csvdb', #the directory csvdb in

Re: manipulating csv file fields through perl

2007-08-27 Thread Jenda Krynicky
From: Mihir Kamdar [EMAIL PROTECTED] I have a csv file. I wanted to do some calculations on some of its fields, like multiplying the 7th field with the 13th field and overwriting the 13th field with the answer of my calculation. Regarding this, can I do the calculations on the input file

manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
Hi, I have a csv file. I wanted to do some calculations on some of its fields, like multiplying the 7th field with the 13th field and overwriting the 13th field with the answer of my calculation. Regarding this, can I do the calculations on the input file and overwrite it after calculating, or I

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
On 8/24/07, Jeff Pang [EMAIL PROTECTED] wrote: 2007/8/24, Mihir Kamdar [EMAIL PROTECTED]: $cdr[13] = $cdr[6]*5 ; ###Can I do something like this sure,why can't? Hi, Please look at my code below and comment. I am trying to manipulate 13th field of my record. But I am not getting

Re: manipulating csv file fields through perl

2007-08-24 Thread Jeff Pang
2007/8/24, Mihir Kamdar [EMAIL PROTECTED]: $cdr[13] = $cdr[6]*5 ; ###Can I do something like this sure,why can't? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: manipulating csv file fields through perl

2007-08-24 Thread Rob Coops
a csv file. I wanted to do some calculations on some of its fields, like multiplying the 7th field with the 13th field and overwriting the 13th field with the answer of my calculation. Regarding this, can I do the calculations on the input file and overwrite it after calculating, or I

Re: manipulating csv file fields through perl

2007-08-24 Thread Rob Coops
Of course it is Your %hash gets filled with a structure that looks like this: { KEY = VALUE } { @cdr[2,3,6,7]= $line} Then you take all the values and write them out to a file. Since you never changed the $line variable you should get the same result in your out file as you

Re: manipulating csv file fields through perl

2007-08-24 Thread Jeff Pang
2007/8/24, Mihir Kamdar [EMAIL PROTECTED]: $cdr[13] = $cdr[6]*5 ; $hash{@cdr[2,3,6,7]}=$line; Hello, I checked the codes,but I'm not sure what's the meanings of those 2 lines above. I can't see the logic relation with the 2 lines.

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
Hi, Thanks...i got my mistake...it worked after the below as Rob suggested:- my @cdr=split (/,/, $line) ; $cdr[13] = $cdr[6]*5.0 ; $line = join(,,@cdr); $hash{@cdr[2,3,6,7]}=$line; But a few

Re: manipulating csv file fields through perl

2007-08-24 Thread Jeff Pang
2007/8/24, Mihir Kamdar [EMAIL PROTECTED]: But a few improvizations. $cdr[13] that I am trying to manipulate is a amount field and should be a floating point value...how can I print it as floating point in perl? Perl isn't a strong type language,it doesn't mind which data type it used. You

Re: manipulating csv file fields through perl

2007-08-24 Thread Mihir Kamdar
Perl isn't a strong type language,it doesn't mind which data type it used. You can use printf() for printing a floating vlaue,like, $ perl -e 'printf(%.2f,3)' 3.00 that's right, but with respect to this particular code of mine, the $cdr[13] is the amount field which should be a float. I am

Re: manipulating csv file fields through perl

2007-08-24 Thread Jeff Pang
2007/8/24, Mihir Kamdar [EMAIL PROTECTED]: Here if I want the $cdr[13] to be written as a float(ex. 15.00), then how do I write it? $cdr[13] = sprintf %.2f, $cdr[6]*5.0 ; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: How to convert csv file to excel

2007-08-15 Thread Chas Owens
On 8/14/07, Lawrence Statton [EMAIL PROTECTED] wrote: Can anybody help me how to convert csv file to excel file using Perl or Shell scripts? I would use Text::CSV_XS to read the CSV file and SpreadSheet::WriteExcel to produce the Excel file. snip In addition to the fine modules you

How to convert csv file to excel

2007-08-14 Thread Kyaw San
Hi Friends, Can anybody help me how to convert csv file to excel file using Perl or Shell scripts? Regards, KS -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: How to convert csv file to excel

2007-08-14 Thread Lawrence Statton
Can anybody help me how to convert csv file to excel file using Perl or Shell scripts? I would use Text::CSV_XS to read the CSV file and SpreadSheet::WriteExcel to produce the Excel file. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

How i convert a excel file to csv file

2007-08-09 Thread Santana
Hei friends, i'am new in newbie in Perl, and i try i convert a excel file in csv file in Suse 10.0 linux. I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux but when i try run this script : use strict; use Spreadsheet::ParseExcel; my $excel = Spreadsheet::ParseExcel

Re: How i convert a excel file to csv file

2007-08-09 Thread Chas Owens
On 8/9/07, Santana [EMAIL PROTECTED] wrote: snip I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux but when i try run this script : snip I have a error something like this : Can´t locate Spreadsheet.pm in @INC(@INC constains : snip Chances are good you did not

Re: How i convert a excel file to csv file

2007-08-09 Thread Paul Lalli
On Aug 9, 3:22 am, [EMAIL PROTECTED] (Santana) wrote: Hei friends, i'am new in newbie in Perl, and i try i convert a excel file in csv file in Suse 10.0 linux. (1) I install the Spreadsheet-ParseExcel-0.32.tar.gz module in my linux (2) use Spreadsheet::ParseExcel; (3) I have a error

Calculating Column Averages from a CSV File

2007-08-09 Thread country
I am trying to calculate column averages (excluding 0's) for all the columns in a CSV file except the first column. My input CSV file is as follows: pickcpua.dat IMAGINGNY,1.45,0.42,1.54,1.49,1.47,1.36,1.81,0.47,1.8,0.55,0.38 JBSQLTST,1.29,1.09,1.13,1.88,1.11,1.44,1.25,1.23,1.05,1.39,1.61

RE: Calculating Column Averages from a CSV File

2007-08-09 Thread Purohit, Bhargav
is not required at all! Bhargav. -Original Message- From: country [mailto:[EMAIL PROTECTED] Sent: Friday, August 10, 2007 12:45 AM To: beginners@perl.org Subject: Calculating Column Averages from a CSV File I am trying to calculate column averages (excluding 0's) for all the columns

RE: How i convert a excel file to csv file ?

2007-08-07 Thread Brown, Rodrick
There is a module on CPAN called Spreadsheet::WriteExcel you can use to read xls data. -Original Message- From: Santana [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 07, 2007 8:22 AM To: beginners@perl.org Subject: How i convert a excel file to csv file ? Hei friends, i'am new

RE: How i convert a excel file to csv file ?

2007-08-07 Thread Wagner, David --- Senior Programmer Analyst --- WGO
, August 07, 2007 07:29 To: Santana; beginners@perl.org Subject: RE: How i convert a excel file to csv file ? There is a module on CPAN called Spreadsheet::WriteExcel you can use to read xls data. -Original Message- From: Santana [mailto:[EMAIL PROTECTED] Sent: Tuesday, August

Re: Splitting a CSV file at a variable number

2007-06-29 Thread Chas Owens
On 6/28/07, sum_duud [EMAIL PROTECTED] wrote: in essence I would like the perl script to output all the fourth column 0 values to a file called phase_0.csv and all the 1 values to phase_1.csv etc. snip use an array of file handles (warning, untested): use strict; use warnings; open my $in,

Splitting a CSV file at a variable number

2007-06-29 Thread sum_duud
I have a large CSV file of the format x,y,z,number (a coordinate file) that I need to parse and output as individual files based on the fourth field (column 3). The file looks like the sample below, and the fourth field can be from zero to 20, so in essence I would like the perl script to output

Re: Help parsing a CSV file

2007-06-25 Thread Mihir Kamdar
On 6/24/07, Tom Phoenix [EMAIL PROTECTED] wrote: On 6/24/07, Mihir Kamdar [EMAIL PROTECTED] wrote: I have a csv file having 3rd field as phone number series. In that field, some of the records are phone number ranges like 097611/4 Now I need to seperate this into 4 numbers and store them one

Re: Help parsing a CSV file

2007-06-25 Thread Tom Phoenix
On 6/25/07, Mihir Kamdar [EMAIL PROTECTED] wrote: if (2 != ($#ARGV+1)) { That works, but it's usually written more like this: if (@ARGV != 2) { open INFILE, $ARGV[0] || die unable to open INFILE; open OUTFILE, $ARGV[1] || die unable to open OUTFILE; These don't do what they look

Help parsing a CSV file

2007-06-24 Thread Mihir Kamdar
Hi, I have a csv file having 3rd field as phone number series. In that field, some of the records are phone number ranges like 097611/4 Now I need to seperate this into 4 numbers and store them one after the other, like:- 097611 097612 097613 097614 There are more than 1000 records in the csv

Re: Help parsing a CSV file

2007-06-24 Thread Rodrick Brown
On 6/24/07, Mihir Kamdar [EMAIL PROTECTED] wrote: Hi, I have a csv file having 3rd field as phone number series. In that field, some of the records are phone number ranges like 097611/4 Now I need to seperate this into 4 numbers and store them one after the other, like:- 097611 097612 097613

Re: Help parsing a CSV file

2007-06-24 Thread Tom Phoenix
On 6/24/07, Mihir Kamdar [EMAIL PROTECTED] wrote: I have a csv file having 3rd field as phone number series. In that field, some of the records are phone number ranges like 097611/4 Now I need to seperate this into 4 numbers and store them one after the other, like:- 097611 097612 097613

Re: Need help with error from certain ASCII characters in a CSV file

2006-07-09 Thread Dr.Ruud
Roman Daszczyszak schreef: #!\perl\perl.exe Does that do anything useful? Maybe change to just #!perl my @lines = @{$csv_file-lines()}; shift @lines; # Strips off the header line before processing Variant: (undef, @my lines) = @{$csv_file-lines()} ; -- Affijn, Ruud Gewoon is een

  1   2   >