Re: Plain text file on web server, questions please...
- From: Bit Twister <BitTwister@xxxxxxxxxxxxxxxx>
- Date: 17 Jun 2007 21:39:37 GMT
On Sun, 17 Jun 2007 21:13:27 +0200 (CEST), Ohmster wrote:
Oh man this looks like something I can use but it is so far over my head
that I am afraid that I am quite lost here.
Well, it was pretty simple. Items starting with $ are variables.
The rest is just syntax. Hey take my quick kludge, run it on the
*.html and faq.txt I gave you and see if you understand it.
It is kinda like having sex, you can read about, but until you "just
do it" you will not get any better at it.
I find it helps to make a small test case, worry with it until it
works, then fold the snippet into the bigger script.
Here, past this into kludge, chmod + x kludge, then start playing using the
test files I gave you.
#**************** start of kludge *****************************
_in_fn=faq.txt
_tmp_fn=aa.txt
_htm_fn=aa.html
_http="http"
function parse_line
{
set -- $line
_new_line=""
while [ $# -gt 0 ] ; do
_wd=$1
if [ ${#_wd} -gt 6 ] ; then
if [ ${_wd:0:4} = "http" ] ; then
_wd="<A HREF=\"${1}/\">${1}</A>"
fi
fi
_new_line="$_new_line $_wd"
shift
done
}
cp /dev/null $_tmp_fn
while read line ; do
parse_line
echo $_new_line >> $_tmp_fn
done < $_in_fn
cat head.html $_tmp_fn tail.html > $_htm_fn
#**************** end of kludge *****************************
I am beginning to think that a shell script might be the only way
possible to do this but I am horrible with shell scripts,
You will not get better unless you keep at it until you are better.
Can someone please help me with this? Do you think I would be better
off asking for help in comp.unix.shell
You may want to read http://www.catb.org/~esr/faqs/smart-questions.html
You would want to post the snippet of code which is not working.
.
- References:
- Re: Plain text file on web server, questions please...
- From: Bit Twister
- Re: Plain text file on web server, questions please...
- From: Ohmster
- Re: Plain text file on web server, questions please...
- From: Bit Twister
- Re: Plain text file on web server, questions please...
- From: Ohmster
- Re: Plain text file on web server, questions please...
- Prev by Date: Re: Shrek the Third (movie)
- Next by Date: Re: Plain text file on web server, questions please...
- Previous by thread: Re: Plain text file on web server, questions please...
- Next by thread: Re: Plain text file on web server, questions please...
- Index(es):