Hello :)
I'm looking to generate a document based on a csv file.
I suck at perl, and am learning as I go.
Here's what I have thus far....
#!perl -w
# open the csv for reading.
open(IPF,"csvinput.txt") or die "Failed to open csv file, $!\n";
# while info come from the IPF handle...
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @html_files = glob("*.html") or die "can't open directory $!\n";
my $new_folder = 'theoutput/';
my $StartTags = "\<td width=\"200\"\>\<font face=\"Arial\" size=\"2\" color=\"Maroon\"\>";
my $EndTags = "\<\/body\>";
my $template1 =...
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @html_files = glob("*.html") or die "can't open directory $!\n";
my $new_folder = 'theoutput/';
my $StartTags = "\<td width=\"200\"\>\<font face=\"Arial\" size=\"2\" color=\"Maroon\"\>";
my $EndTags = "\<\/body\>";
print "\n"...
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @html_files = glob("*.html") or die "can't open directory $!\n";
my $new_folder = 'theoutput/';
foreach my $original_doc (@html_files) {
print "Processing $original_doc\n";
my $new_file = "$new_folder$original_doc"...
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @html_files = glob("~/perltest/*.html") or die "can't open directory $!\n";
my $new_folder = 'theoutput/';
foreach my $doc (@html_files) {
print "Processing $doc\n";
my $new_file = "$new_folder$doc";
open...
Someone on another forum said :
"You'll eventually be matching HTML tags. Will these ever change or will they always be exactly as you've posted them? If they're likely to be any different at any stage, you'd probably be better off using a proper tag-aware HTML parser (such as...
[jmackenz@phoenix perltest]$ perl removedata.pl
Global symbol "$linesFromFile" requires explicit package name at removedata.pl line 14.
Execution of removedata.pl aborted due to compilation errors.
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @htmlFiles = glob($pathToFiles/*.html) or die "can't open directory $!\n";
foreach my $c(@htmlFiles){
open (HTML, $c);
for ( $linesFromFile ) {
if ( /^StartTags/gm .. /^EndTags/gm ) {
print > /folder2/$c;
}
}
Thanks for the info :)
To be a little more clear , I have 385 files that have data contained between the following :
<table><tr>
<td width="200"><font face="Arial" size="2" color="Maroon">
and
</table>
</center>
</body>
</html>
I'd like to Insert the text between two editable region...
So... reading through the forum posts , i've hack and slashed a little
and ended up here :
#!/usr/bin/perl -w
use strict;
#local $/; # slurp mode
my @htmlFiles = glob(pathToFiles/*.html) or die "can't open directory $!\n";
my @linesFromFile=<DATA>;
foreach my $c(@htmlFiles){
open (HTML...
Hello everyone!
Thank you for taking the time to look at this.
Basically what i'm attempting to do is open every file in a directory, look at the contents and take the data between two statements (groups of html tags) that are consistently in each document and create a new file in a second...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.