RE: using wc -l in perl

2007-08-08 Thread Purohit, Bhargav
10:11 PM To: Chas Owens Cc: beginners Subject: Re: using wc -l in perl On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I am trying to count the number of lines in my output file processed &g

RE: using wc -l in perl

2007-08-08 Thread Purohit, Bhargav
long unix is unable to count it And end up giving 0 count Bhargav -Original Message- From: Mihir Kamdar [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 07, 2007 10:11 PM To: Chas Owens Cc: beginners Subject: Re: using wc -l in perl On 8/7/07, Chas Owens <[EMAIL PROTECTED]> w

Re: using wc -l in perl

2007-08-07 Thread John W. Krahn
John W. Krahn wrote: John W. Krahn wrote: I rewrote your code so that: 1) It opens the log file once at the start; 2) Adds more error checking; 3) Prints an accurate count of input and output lines; 4) Preserves the same order of the input lines on output; so hopefully this will work better

Re: using wc -l in perl

2007-08-07 Thread rcook
> what is the $OUT_FILE? If you saw Chas owens response to the original message you would have read That would be because $OUT_FILE is a file handle, not the file's name. You should also not be using the qx// operator (aka backticks) to do this, Perl can handle it just fine: It is a name, h

Re: using wc -l in perl

2007-08-07 Thread flw
what is the $OUT_FILE? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: using wc -l in perl

2007-08-07 Thread John W. Krahn
John W. Krahn wrote: I rewrote your code so that: 1) It opens the log file once at the start; 2) Adds more error checking; 3) Prints an accurate count of input and output lines; 4) Preserves the same order of the input lines on output; so hopefully this will work better for you. #!/usr/bin

Re: using wc -l in perl

2007-08-07 Thread John W. Krahn
Mihir Kamdar wrote: Following is my code:- [ SNIP ] At last I am trying to get the count of lines of my OUT_FILE. It is giving me the result as 0, which is not true. Where am i doing a mistake? I rewrote your code so that: 1) It opens the log file once at the start; 2) Adds more error ch

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
Hi Chas, my $count ; open (my $LOG_FILE,">","$write_path/logfile3") ; for ($count=0; <$IN_FILE>; $count++) { } print $LOG_FILE "Count of c

Re: using wc -l in perl

2007-08-07 Thread Chas Owens
On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > yes Chasit says:- > there are 0 keys in hash snip > > i think something is going terribly wrong with my code...can u quickly point > out and advice? snip It is difficult to tell, you are not using the strict or warnings pragmas and your inde

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
yes Chasit says:- there are 0 keys in hash while (my($key, $value) = each %hash) { print $OUT_FILE $value; $value++ ; #print $LOG_FILE "Count of cdrs after removing duplicates = " .(keys%hash). "\n

Re: using wc -l in perl

2007-08-07 Thread Chas Owens
On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: snip > I am doing the following: > > while (my($key, $value) = each %hash) > { > print $OUT_FILE $value; > } > > seek $OUT_FILE,0,0 ; >

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > snip > > open (my $OUT_FILE,"+>","$write_path/$file.out") or die > $!; > > > > while (my($key, $value) = each %hash) > > { > >

Re: using wc -l in perl

2007-08-07 Thread Chas Owens
On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: snip > open (my $OUT_FILE,"+>","$write_path/$file.out") or die $!; > > while (my($key, $value) = each %hash) > { > print $OUT_FILE $value; > } >

Re: using wc -l in perl

2007-08-07 Thread Mihir Kamdar
On 8/7/07, Chas Owens <[EMAIL PROTECTED]> wrote: > > On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I am trying to count the number of lines in my output file processed by > a > > perl code. > > > > I am not getting the syntax correct. I am doing something like below:- > > > > m

Re: using wc -l in perl

2007-08-07 Thread Chas Owens
On 8/7/07, Mihir Kamdar <[EMAIL PROTECTED]> wrote: > Hi, > > I am trying to count the number of lines in my output file processed by a > perl code. > > I am not getting the syntax correct. I am doing something like below:- > > my $count1 = `wc -l < $OUT_FILE` ; > print $LOG_FILE "Count of cdrs afte

using wc -l in perl

2007-08-07 Thread Mihir Kamdar
Hi, I am trying to count the number of lines in my output file processed by a perl code. I am not getting the syntax correct. I am doing something like below:- my $count1 = `wc -l < $OUT_FILE` ; print $LOG_FILE "Count of cdrs after removing duplicates = $count1" ; I am getting the following er