Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Perl script to find particular string and save those lines in another file?

by sumathigokul (Acolyte)
on May 05, 2015 at 06:11 UTC ( #1125672=note: print w/replies, xml ) Need Help??


in reply to Re: Perl script to find particular string and save those lines in another file?
in thread Perl script to find particular string and save those lines in another file?

Thank you, this code works.

use strict; my $find = "2"; open (NEW, ">", "new.txt" ) or die "could not open:$!"; open (FILE, "<", "high_fanout.txt") or die "could not open:$!"; while (<FILE>) { print NEW if (/$find/); } close (FILE); close (NEW);
  • Comment on Re^2: Perl script to find particular string and save those lines in another file?
  • Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (1)
As of 2023-03-25 03:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (62 votes). Check out past polls.

    Notices?