APPENDIX D2
************************************************************
* USING SHELL PROGRAMS TO SUBMIT *
* YOUR MIDTERM AND FINAL PROJECTS *
************************************************************
If you have many HTML documents, it may be worth using a
shell script to automate the conversion from HTML documents
to text, then organizing these text files into a midterm
paper. I describe below the method I have used for all my
HTML documents. I would advise you to use this technique
only if you feel comfortable with it.
1. You should first backup all your files before proceeding
further. For example, from your current subdirectory,
create a subdirectory, called TEXT, with the command:
mkdir TEXT
2. Copy all the HTML documents you want part of your Midterm
into the TEXT subdirectory. If you want to copy all your
HTML files into this directory, type, from your current
subdirectory:
cp *html TEXT
3. Go to your TEXT subdirectory, and edit a file, called
'conversion' for example, with the following text (called
a shell script).
We owe this program to one of my students, John Rogers:
for x in *.html
do
lynx -dump $x > $x.txt
done
4. Save the file, and make it executable, with the command:
chmod 700 conversion
5. Type the command:
conversion
6. As a result, it will create, for each file with extension
.html, a new file, with the double extension .html.txt
7. You can then use the cat command to concatenate all your
documents with the double extension .html.txt into one
document.
You can again make use of a shell script file:
a) edit a file called 'concat' with the cat command:
cat filea fileb filec > midterm
(with filea, fileb etc.. replaced by your own files, with
the double extension .html.txt). You may also use wild
cards (using the '*' symbol, to name collectively a group
of files.
For example, for my tutorial on database, I used:
cat design* sql* quel* > database.course
b) save the file
c) make the 'concat' file executable, with:
chmod 700 concat
d) and execute the file, by typing the command:
concat
You can finally edit file 'midterm' to give it a better
presentation.
.bp