Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by Punitha (Priest)
on Feb 14, 2008 at 09:39 UTC ( #667901=note: print w/replies, xml ) Need Help??


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

Hi tuakilan, try this

use strict; open(IN,'logfile.txt') or die("cannot open the log file for reading\n" +); open(OUT,'>output.txt') or die("cannot open the output file for writin +g\n");######To create the output file while(<IN>){######to read the input file print OUT "$_" if($_=~/\bTWO\b/i); } close(IN); close(OUT);

Punitha

  • Comment on Re: How to read a text file, extract a records that contains a string, export the result into a temporary file
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://667901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2016-10-01 21:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?






    Results (8 votes). Check out past polls.