CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [FishMonger] how to extract text between 2 strings on separate lines: Edit Log



ozosan
New User

Nov 13, 2013, 8:20 AM


Views: 1770
Re: [FishMonger] how to extract text between 2 strings on separate lines

Sorry for the confusion, here it is :

Code
use strict; 
use warnings;
my $record = "";
opendir (DIR, "C:/Users/input/") or die "$!";
my @files = readdir DIR;
close DIR;
splice (@files,0,2);

open(MYOUTFILE, ">>output/output.txt");
foreach my $file (@files) {
open (CHECKBOOK, "input/$file")|| die "$!";
while ($record = <CHECKBOOK>) {

if ($record=~ /^start\b$/ .. /^end\b$/) {
print MYOUTFILE "$file;$record\n";

}
}
close(CHECKBOOK);

}
close(MYOUTFILE);



(This post was edited by ozosan on Nov 13, 2013, 8:21 AM)


Edit Log:
Post edited by ozosan (New User) on Nov 13, 2013, 8:21 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives