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
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
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
> 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
what is the $OUT_FILE?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
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
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
Hi Chas,
my $count ;
open (my
$LOG_FILE,">","$write_path/logfile3") ;
for ($count=0; <$IN_FILE>; $count++)
{ }
print $LOG_FILE "Count of c
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
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
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 ;
>
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)
> > {
> >
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;
> }
>
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
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
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
16 matches
Mail list logo