home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 8
/
amigaformatcd08.iso
/
in_the_mag
/
html_tutorial
/
convert.sh
< prev
next >
Wrap
Linux/UNIX/POSIX Shell Script
|
1996-05-09
|
1KB
|
59 lines
#!/bin/bash
#Edit these to reflect your own machine
#These reflect the curently values in the files
export MY_HOST_ONE="snowwhite.it.bton.ac.uk"
export MY_HOST_TWO="www.brighton.ac.uk"
export MY_PATH="~mas"
export MY_RECORD_FILE="~mas\/htp\/mas_logs"
export MY_DIR="~mas\/mas\/courses\/html"
#Example edits - so change these
export MY_HOST_ONE="hyperion"
export MY_HOST_TWO="hyperion"
export MY_PATH="~www\/..\/"
export MY_RECORD_FILE="~www\/..\/logs\/mas_logs"
# Start of conversion
# Do not change anything beyond this line
export DIRECTORY=`pwd`
echo "Converting .htm files to .html"
cat <<+END+ > __convert2
echo \$1
sed -f $DIRECTORY/__convert3 < \$1 > \$1l
+END+
cat <<+END+ > __convert3
s/snowwhite.it.bton.ac.uk/$MY_HOST_ONE/g
s/snowwhite.it.brighton.ac.uk/$MY_HOST_ONE/g
s/www.brighton.ac.uk/$MY_HOST_TWO/g
s/www.bton.ac.uk/$MY_HOST_TWO/g
s/~mas\/mas\/courses\/html/$MY_DIR/g
s/~mas\/htp\/mas_logs/$MY_RECORD_FILE/g
s/~mas/$MY_PATH/g
s/\.htm/\.html/g
s/\.htmll/\.html/g
s/$//
+END+
find . -name "*.htm" \
-exec sh $DIRECTORY/__convert2 {} ";"
rm -f __convert2 __convert3
echo "Removing ^M from .cpp .h and .ada files"
cat <<+END+ > __convert2
echo \$1
sed -f $DIRECTORY/__convert3 < \$1 > \$1.xxx
mv \$1.xxx \$1
+END+
cat <<+END+ > __convert3
s/$//
+END+
find . "(" -name "*.cpp" -o -name "*.h" -o -name "*.ada" -o -name "*.htm" ")" \
-exec sh $DIRECTORY/__convert2 {} ";"
rm -f __convert2 __convert3