[Bio] / KBaseTutorials / split_tutorial_for_iris.pl Repository:
ViewVC logotype

View of /KBaseTutorials/split_tutorial_for_iris.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (download) (as text) (annotate)
Wed Jun 13 21:18:36 2012 UTC (7 years, 4 months ago) by olson
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -0 lines
Iris internal tutorial

use strict;

my $usage = "Usage: $0 input-file output-file-base\n";

@ARGV == 2 or die $usage;

my $in = shift;
my $out_base = shift;

open(IN, "<", $in) or die "Cannot open $in: $!";

my @existing = <${out_base}[0-9]*.html>;

unlink @existing;

my $cur = 0;
my $out;
while (<IN>)
{
    if (m,^<h2>(.*)</h2>,)
    {
	my $title = $1;
	print "Have title $title out=$out cur=$cur\n";
	if ($out)
	{
	    print $out "<p>\n";
	    close($out);
	}
	$cur++;
	open($out, ">", "${out_base}$cur.html") or die "Cannot open ${out_base}$cur.html: $!";
	# print $out $_;
    }
    elsif ($out)
    {
	print $out $_;
    }
}
close($out);
 

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3