You didn't get a reply because explaining how to install and set up a script is a bit more complex than a one-post deal, and has probably been asked a million times. :-) But there is an EASIER way to do this!
Does your server support Server Side Includes? Most do.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!-- Put the previous two lines ALL ON ONE LINE! -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Be sure to use a good title, it's important</title>
<meta name="Description" content="Ditto">
<meta name="keywords" content="Ditto">
</head>
<body>
<h1>The heading tag is important too</h3>
<pre>
<!-- #include file="myfile.txt" -->
</pre>
</body>
</html>
Copy and paste, change "myfile.txt" to one of your text files, and save it as test.shtml. Shtml is very important, it tells the server to look for include directives in the file. Upload it to the same directory as your text files.
The magic line is the include line. If you put your text files in a folder and not the same directory as the shtml files, use virtual instead:
<!-- #include virtual="/textfiles/myfile.txt" -->
If you try this and get "an error has ocurred while processing this directive" includes will work on your server, but you're doing something wrong - the case is wrong (Myfile.txt) or the file is not present.
If this doesn't work I have sent you a sticky mail.
And I am not sure how would I use this:
<iframe><pre>stuff here</pre></iframe>
Since I have to specify <iframe src="myfile.txt">
Anyway I had to write a long long script combining echo and sed commands to wrapt txt files with pre tags. But as long as it is sorted in the end I am happy.
Here is what I used.
echo "</pre>" >> file.txt this inserts </pre> at the end of txt file. In combination with this:
sed 's/word/<pre>/g' file.txt > /destination/folder/file.txt to replace first word in file with <pre> and save output to where I need the files.
Here is an easier solution that inserts tags at the beginning and the end of all txt files in specified folder without replacing any words in the files.
files="ls /data/*.txt"
echo '<pre>' > /tmp/head
echo '</pre>' > /tmp/tailfor i in $files
do
out="/tmp/out.$$"
cat /tmp/head $i /tmp/tail > $out
cp $out $i
rm -f $out
done
rm -f /tmp/head /tmp/tail