The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 03-18-2009
SkySmart SkySmart is offline
Registered User
  
 

Join Date: Dec 2006
Posts: 50
Quote:
Originally Posted by KevinADC View Post
Similar to my reply in your other thread that I think you didn't read. Assumes same example data from that thread.

This should be more efficient and maybe more accurate:


Code:
#!/usr/local/bin/perl
use strict;

open (MYFILE, 'logs_report') or die "$!";
open (MYF, '>data.txt') or die "$!";

while (my $rec = <MYFILE>) {
    next if ($rec =~ /STATE: OK/) {
    print MYF $rec;
}
close (MYF);
close (MYFILE);

Pludis code has a small typo, it has $red where it should be $rec.
yes i did read your post in the other thread. when i went to use it i wasn't getting any response back. i think the problem was in the line that i bolded.

i'll try this script of yours and see if it outputs something. thanks a million.