txttohtml - convert text to HTML format

To convert a number of files from text to HTML format, log into cedr.lbl.gov and execute the following (for example):

alias txttohtml /h/merrill/bin/txttohtml
txttohtml *.txt
New files in HTML format, with names *.txt.html will be created. The old files *.txt are not removed.

#!/vol/local/perl
# /h/merrill/bin/txttohtml 4/23/96
# convert all files in command line to html; append .html to file names
# example: txttohtml *.txt
for $file (@ARGV) {
	open (INFILE, $file);
	open (OUTFILE, ">" . $file . ".html" );
	print OUTFILE '<pre>',"\n";
	while (<INFILE>) {
		s/&/&amp;/g;
		s/</&lt;/g;
		s/>/&gt;/g;
		s/"/&quot;/g;
		print OUTFILE;
	}
	print OUTFILE '</pre>',"\n";
	close INFILE;
	close OUTFILE;
}
back to software maintained by Deane Merrill


http://merrill.olm.net/mdocs/txttohtml.html 4/23/96
dwmerrill@lbl.gov