http://danconia.org
Joshua Kaufman wrote:
How unfortunate for me ;-) -- josh On 11/23/02 2:17 PM, "Paul Johnson" <[EMAIL PROTECTED]> wrote:On Sat, Nov 23, 2002 at 02:05:58PM -0600, Joshua Kaufman wrote:Thanks for the reply. That would work in this context, but I'm looking for the more general answer, mostly just to convince myself that I'm not crazy and have done it this way before.I'm sorry to report that you may be crazy ;-) Altering $. has no effect on the position of a filehandle.On 11/23/02 8:44 AM, "Wiggins d'Anconia" <[EMAIL PROTECTED]> wrote:You could always say <LOG> again inside your if to print the next line. Realize that you will not then be able to check that line for the string, but if that is ok which it sounds like it is then it should work. See below. Joshua Kaufman wrote:Hi All;
I'm trying to match a pattern in a text file and then print out the next
line in that file. I could swear that I've done this before by incrementing
$. to move to the next line. However, the code below is printing out the
matched line rather than the next line.
#!/usr/bin/perl
open (LOG, "./lmelog");
for ( <LOG> ) {
if ( /- Student Id/){
++$.;
print "$_\n";
print <LOG>;} }Joshua R. Kaufman | Product Development Manager | Impart Knowledge Solutions, Inc. | 312-496-5669, x1003
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]