Re: looping through a file

2007-05-09 Thread Steve Bertrand
but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if ( $line =~ /$prime_id/ ) { print $line\n;

Re: looping through a file

2007-05-09 Thread Rob Dixon
Steve Bertrand wrote: but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if ( $line =~ /$prime_id/ ) {

Re: looping through a file

2007-05-09 Thread Chas Owens
On 5/9/07, Rob Dixon [EMAIL PROTECTED] wrote: Steve Bertrand wrote: but if they appear in the file in a different sequence then you also need to rewind and start looking at the beginning of the file once again like this: ID: foreach my $prime_id ( @id_hits ) { while ( my $line =

RE: looping through a file

2007-05-08 Thread Craig Schneider
Hi Guys Following is a log file extract which I desperately need to covert to coma separated for an entire logile called access.log (squid proxy log) for reporting purposes. There has been some internet surfing abuse on a client's network. 1178606984.937 1 192.168.1.55 TCP_DENIED/407 1904

Re: looping through a file

2007-05-08 Thread Dr.Ruud
Robert Hicks schreef: open my $IFILE, '', $IDFILE || die Could not open $IDFILE: $!; This doesn't mean what you assume it does. It is a mix up of: open(my $IFILE, '', $IDFILE) || die Could not open $IDFILE: $!; and open my $IFILE, '', $IDFILE or die Could not open $IDFILE: $!; --

Re: looping through a file

2007-05-08 Thread Robert Hicks
I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE ) { if (

Re: looping through a file

2007-05-08 Thread yaron
, May 8, 2007 4:39:12 PM (GMT+0200) Auto-Detected Subject: Re: looping through a file I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match

Re: looping through a file

2007-05-08 Thread Jeff Pang
-Original Message- From: [EMAIL PROTECTED] Sent: May 8, 2007 9:54 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: looping through a file my @lines = $AFILE; foreach my $prime_id ( @id_hits ) { foreach my $line( @lines ) { if ( $line =~ /$prime_id

Re: looping through a file

2007-05-08 Thread Rob Dixon
Robert Hicks wrote: I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while ( my $line = $AFILE

Re: looping through a file

2007-05-08 Thread Rob Dixon
Jeff Pang wrote: -Original Message- From: [EMAIL PROTECTED] Sent: May 8, 2007 9:54 PM To: [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: looping through a file my @lines = $AFILE; foreach my $prime_id ( @id_hits ) { foreach my $line( @lines ) { if ( $line

Re: looping through a file

2007-05-08 Thread Robert Hicks
Rob Dixon wrote: Robert Hicks wrote: I decided to back up a bit and try a more simple routine. I have the array @id_hits populated and I can search the log for the line and print it. The problem is it only finds the first match and that is it. foreach my $prime_id ( @id_hits ) { while (

looping through a file

2007-05-07 Thread Robert Hicks
I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find the line that the id is on, I need the next line

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this log. Once I find

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: I have one file that contains a log. I do a substr to get the information out of that and push it into an array. I have a second file that contain another log. I need to loop through the items in the array and find them in this

Re: looping through a file

2007-05-07 Thread Chas Owens
On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as well. snip

Re: looping through a file

2007-05-07 Thread Robert Hicks
Chas Owens wrote: On 5/7/07, Robert Hicks [EMAIL PROTECTED] wrote: snip I think part of the problem is the 'shift'ing that I was doing. I am looking into that. Basically I was shift'ing the @log out of existence after the first pass. snip That sounds like a viable candidate for the warning as

Re: help looping through text file

2003-12-13 Thread Joel Newkirk
On Fri, 2003-12-12 at 15:59, John Fitzgerald wrote: I need a list set like this: IDdate 3008 11/1/03 3008 11/1/03 3008 11/1/03 3010 12/1/03 3010 12/1/03 So I need repeating ID's, with the earliest date for each ID. If the order of the data is preserved, I can use just those

Re: help looping through text file

2003-12-13 Thread John W. Krahn
John Fitzgerald wrote: Hi, Hello, I'm fairly new to Perl, and trying to do a simple operation on a text file exported from excel. ID Enrolled Extraneous Columns 300805-Aug-03 300805-Aug-03 300805-Aug-03 300805-Aug-03 300824-Sep-03 300911-Aug-03

Re: help looping through text file

2003-12-12 Thread Rob Dixon
John Fitzgerald wrote: Hi, I'm fairly new to Perl, and trying to do a simple operation on a text file exported from excel. ID Enrolled Extraneous Columns 3008 05-Aug-03 3008 05-Aug-03 3008 05-Aug-03 3008 05-Aug-03 3008 24-Sep-03 3009 11-Aug-03 3010 19-Nov-03 3010 11-Jul-03

Re: help looping through text file

2003-12-12 Thread John Fitzgerald
Thanks for the reply, I don't have date::calc but I can CPAN it right now. I need a list set like this: IDdate 3008 11/1/03 3008 11/1/03 3008 11/1/03 3010 12/1/03 3010 12/1/03 So I need repeating ID's, with the earliest date for each ID. If the order of the data is preserved, I can use

Re: help looping through text file

2003-12-12 Thread Rob Dixon
John Fitzgerald wrote: --- Rob Dixon [EMAIL PROTECTED] wrote: John Fitzgerald wrote: Hi, I'm fairly new to Perl, and trying to do a simple operation on a text file exported from excel. ID Enrolled Extraneous Columns 3008 05-Aug-03 3008 05-Aug-03 3008

Re: help looping through text file

2003-12-12 Thread R. Joseph Newton
John Fitzgerald wrote: Hi, I'm fairly new to Perl, and trying to do a simple operation on a text file exported from excel. ID Enrolled Extraneous Columns 300805-Aug-03 300805-Aug-03 300805-Aug-03 300805-Aug-03 300824-Sep-03 300911-Aug-03 3010