Re: Plain text file on web server, questions please...
- From: Bit Twister <BitTwister@xxxxxxxxxxxxxxxx>
- Date: 17 Jun 2007 14:25:58 GMT
On Sun, 17 Jun 2007 15:52:27 +0200 (CEST), Ohmster wrote:
Since I do not want to have two copies of the FAQ (More chance for
errors and also more work to maintain.), is there any way in Linux to
automate making an HTML wrapper to throw around this text document,
strictly for online viewing that would add the HTML tags to the online
version such as <body></body>, and especially the link tags like this:
<A href="http://www.foobar.com/foobarFAQ.txt">FAQ</A>
I have been using Linux for over ten years but some of the really in
depth stuff I really am not familiar with (Just ask me what "awk" is, I
will probably tell you that it is a sound that birds make. <g>) Is there
a utility that would do this or can it be done with a shell script
perhaps? All links in the text document would begin with http:// and
that is something identifiable to search for if one were to try and
script it.
Just for fun, create fyi.txt, head.html and tail.html files.
head.html has
<HTML>
<BODY BGCOLOR="#99CCCC" LINK="#0000FF" VLINK="#FF0000"
ALINK="#FF0000" TEXT="#000000">
<pre>
tail.html has
</pre>
</BODY>
</HTML>
faq.txt has
Today's tip
For extra points, read http://tldp.org/LDP/abs/html/index.html
Now run the command
cat head.html faq.txt tail.html > aa.html
To test, put aa.html in your browser and see if it works.
Could cron be used to copy the document over prior to adding the HTML
tags right before posting and then when posting again, do the same
thing, this way that if anything changed in the FAQ, it would also be
changed in the online version as well?
Well, your script just does the commands you would do by hand. You
have to figure out how to compute any variables.
I have a humor/fyi email list kinda like you do.
Instead of version I used date.
_date=$(date +%Y-%m-%d)
cat head.html joke.txt tail.html > joke_${_date}.html
cat head.html fyi.txt tail.html > fyi_${_date}.html
Those create joke_2007-06-17.html and fyi_2007-06-17.html
You can store a variable in a file. Script fetches it, bump it, save it,
use it.
#********* start of snippet **************
# read, bump,save version
source /somewhere/version
_ver=$(( $_ver + 1))
echo _ver=$_ver > /somewhere/version
cat head.html faq.txt tail.html > aa_$_ver.html
#********* end of snippet **************
For extra points, read http://tldp.org/LDP/abs/html/index.html
.
- Follow-Ups:
- Re: Plain text file on web server, questions please...
- From: Ohmster
- Re: Plain text file on web server, questions please...
- From: Ohmster
- Re: Plain text file on web server, questions please...
- Prev by Date: Re: Using Microsoft Programs with Ubuntu
- Next by Date: Re: Plain text file on web server, questions please...
- Previous by thread: Linux Training Tips - Boot Linux from a Linux Installation CD or a Linux Live CD to Learn Linux
- Next by thread: Re: Plain text file on web server, questions please...
- Index(es):
Relevant Pages
|