Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

How to read a text file, extract a records that contains a string, export the result into a temporary file

by tuakilan (Acolyte)
on Feb 14, 2008 at 09:11 UTC ( [id://667896]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    1. read a log file
    2. search the logfile.txt for a specific string, in this case the stri
    +ng "TWO"
    3. extract record that contains the string "TWO" from log file into an
    +other file
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    
    while $fh->getline;
    $fh->close;
    
  3. or download this
    2007-Nov-07 00:00:00 UTC (GMT +0000) - Poll: channel = ONE, ref =
    2007-Nov-07 00:00:01 UTC (GMT +0000) - Poll: channel = TWO, ref =
    ...
    2007-Nov-07 00:00:03 UTC (GMT +0000) - Poll: channel = TWO, ref =
    2007-Nov-07 00:00:03 UTC (GMT +0000) - Poll: channel = TWO, ref =
    2007-Nov-07 00:00:04 UTC (GMT +0000) - Poll: channel = TWO, ref =
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://667896]
Approved by svenXY
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-03-19 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found