in reply to Grabbing part of an HTML page
Try this, but beware of:
#! /usr/bin/perl -w use strict; my $start_pattern = '<!-- start section-->'; my $end_pattern = '<!-- end section -->'; my @files_to_look_in = ('/path/to/files1.html', '/path/to/files2.html' +); my $write_line = 0; foreach (@files_to_look_in) { open HTM_FILE, "<$_"; while (<HTM_FILE>) { $write_line = 1 if /$start_pattern/i; $write_line = 0 if /$end_pattern/i; print $_, "\n" if $write_line; } close HTM_FILE; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Grabbing part of an HTML page
by kingdean (Novice) on Mar 28, 2004 at 22:45 UTC | |
by pbeckingham (Parson) on Mar 29, 2004 at 00:16 UTC |