ICSE 2001 Logo   Rigi Logo
 
Resources: Notes to the Web Maintainer
Scripts for Site-wide Changes:

Below are two variations of the same script, which Johannes created in order to make changing the layout of multiple pages at once a lot faster. They were designed for very specific changes, but if similar changes are needed, talk to Johannes to see if it is worthwhile and/or possible to change the scripts. The scripts (similar to a .bat file in DOS) use only two programs, tr and sed.

tr replaces all characters in the first set by characters in the second set. For example, tr '\n' '$' replaces all newlines by $s (the other tool, 'sed' works better if you don't have newlines).

sed can do many things, but the feature used here is replacement of regular expression. A regular expression is a sequence of characters where some characters have special meanings. For example, 'My name is [A-Z][a-z]+' would match "My name is Johannes" and "My name is Ian." Another example: to change the font size from 5 to 6, use: sed 's+<font size="5"+<font size="6"+' This means replace the first occurence of <font size="5"> with <font size="6">.

In creating the Rigi Web site, the script was used to:

  • change the page background colour
  • change a cell's row/column span, alignment, pixel dimensions, colour, and other properties
  • move text to a different cell
  • change font size
  • move components to a different cell
  • delete cell contents
  • insert "../../Rigi.data/Components/footer.html"

Here is the script used for all pages excluding the .shtml files:

#!/bin/sh
#- remove newlines:
tr '\n' '$' | \

#- change page background colour to black
sed 's+body bgcolor="white"+body bgcolor="black"+' | \

#- change size of logo header
sed 's+w="575" h="115"+w="558" h="110"+' | \

#- chg 2nd row "col span" to 1
#- copy text only to next cell to the right
#- move buttons to former heading cell (2nd row, 1st col)
sed 's+<td width="175" bgcolor="#009999" nowrap align="left" height="450" valign="top"><csobj.*</td>$[[:space:]]*<td bgcolor="white" +<td bgcolor="white" +' | \

sed 's+<td bgcolor="#009999" colspan="2">+<td bgcolor="#009999" width="160" rowspan="2" valign="top"><div align="left">$<csobj w="160" h="276" t="Component" csref="../../Rigi.data/Components/navigation.html" occur="0">$<table cool width="151" height="271" border="0" cellpadding="0" cellspacing="0" gridx="16" showgridx usegridx gridy="16" showgridy>$<tr height="1" cntrlrow>$<td width="1" height="1"></td>$<td width="150" height="1"><spacer type="block" width="150" height="1"></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/hometest2.gif"><a href="../index.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00homeä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00homeä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/hometest1.gif" width="150" height="30" name="Cmp0055B61A00home" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/descrtest2.gif"><a href="description.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00descriptionä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00descriptionä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/descrtest1.gif" width="150" height="30" name="Cmp0055B61A00description" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/downtest2.gif"><a href="download.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00downloadä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00downloadä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/downtest1.gif" width="150" height="30" name="Cmp0055B61A00download" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/projtest2.gif"><a href="projects.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00projectsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00projectsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/projtest1.gif" width="150" height="30" name="Cmp0055B61A00projects" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/publtest2.gif"><a href="publications.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00publicationsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00publicationsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/publtest1.gif" width="150" height="30" name="Cmp0055B61A00publications" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/resotest2.gif"><a href="resources.shtml" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00resourcesä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00resourcesä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/resotest1.gif" width="150" height="30" name="Cmp0055B61A00resources" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/spontest2.gif"><a href="sponsors.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00sponsorsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00sponsorsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/spontest1.gif" width="150" height="30" name="Cmp0055B61A00sponsors" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/sitetest2.gif"><a href="siteinfo.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00site infoä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00site infoä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/sitetest1.gif" width="150" height="30" name="Cmp0055B61A00site info" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/conttest2.gif"><a href="contact.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00contact usä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00contact usä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/conttest1.gif" width="150" height="30" name="Cmp0055B61A00contact us" border="0"></a></csobj></td>$</tr>$</table>$</csobj></div>$</td>$<td bgcolor="#009999">+' | \
tr 'ä' "'" | \

sed 's+<div align="left">$[[:space:]]*<table cool width="573" height="43" border="0" cellpadding="0" cellspacing="0" gridx="16" showgridx gridy="16" showgridy>$[[:space:]]*<tr height="1" cntrlrow>$[[:space:]]*<td width="1" height="1"></td>$[[:space:]]*<td width="8" height="1"><spacer type="block" width="8" height="1"></td>$[[:space:]]*<td width="376" height="1"><spacer type="block" width="376" height="1"></td>$[[:space:]]*<td width="188" height="1"><spacer type="block" width="188" height="1"></td>$[[:space:]]*</tr>$[[:space:]]*<tr height="2">$[[:space:]]*<td width="1" height="2"><spacer type="block" width="1" height="2"></td>$[[:space:]]*<td width="8" height="2"></td>$[[:space:]]*<td width="376" height="2"></td>$[[:space:]]*<td width="188" height="2"></td>$[[:space:]]*</tr>$[[:space:]]*<tr height="40">$[[:space:]]*<td width="1" height="40"><spacer type="block" width="1" height="40"></td>$[[:space:]]*<td width="8" height="40"></td>$[[:space:]]*<td width="376" height="40" colspan="1" rowspan="1" valign="top" align="left" xpos="8" content csheight="40">$[[:space:]]*<div align="left">++' | \
sed 's+</div>$[[:space:]]*</td>$[[:space:]]*<td width="188" height="40"></td>$[[:space:]]*</tr>$[[:space:]]*</table>$[[:space:]]*</div>++' | \

#- change heading font to size=6
sed 's+<font size="5"+<font size="6"+' | \

#- change to row span=2, alignment=top, col width to 160 pixels
sed 's+w="175" h="456"+w="160" h="276"+' | \

#- remove contents of 4th row, 2nd col cell
#- replace with "../../Rigi.data/Components/footer.html"

sed 's+<font size="2">$[[:space:]]*<hr>$[[:space:]]*\[<a href="../index.html">home</a>\] \[<a href="whatitis.html">what it is</a>\] \[<a href="howitworks.html">how it works</a>\] \[<a href="features.html">features</a>\] \[<a href="methodology.html">methodology</a>\] \[<a href="success.html">success</a>\] \[<a href="platforms.html">platforms</a>\] \[<a href="download.html">download</a>\] \[<a href="glossary.html">glossary</a>\] \[<a href="projects.html">projects</a>\] \[<a href="publications.html">publications</a>\] \[<a href="resources.shtml">resources</a>\] \[<a href="sponsors.html">sponsors</a>\] \[<a href="siteinfo.html">site info</a>\] \[<a href="contact.html">contact us</a>\]</font></center>+<font size="2"><csobj w="377" h="36" t="Component" csref="../../Rigi.data/Components/footer.html" occur="81">$<center>$<font size="2">\[<a href="../index.html">home</a>\] \[<a href="whatitis.html">description</a>\] \[<a href="download.html">download</a>\] \[<a href="projects.html">projects</a>\] \[<a href="publications.html">publications</a>\] \[<a href="resources.shtml">resources</a>\] \[<a href="sponsors.html">sponsors</a>\] \[<a href="siteinfo.html">site info</a>\] \[<a href="contact.html">contact us</a>\]</font></center>$</csobj></font></center>+' | \
#
#- chg colour of 4th row, 1st col to aqua (009999)
sed 's+<td width="175" bgcolor="white">+<td width="160" bgcolor="#009999"><spacer type="block" width="1" height="1">+' | \

#- chg 3rd row, 2nd col height to 230 pixels
sed 's+ height="450"+ height="230"+g' | \
#
#- restore newlines
tr '$' '\n'

Here is the version for the .shtml files (the links at the bottom of the page were a little different):

#!/bin/sh

#- remove newlines:
tr '\n' '$' | \

#- change page background colour to black
sed 's+body bgcolor="white"+body bgcolor="black"+' | \

#- change size of logo header
sed 's+w="575" h="115"+w="558" h="110"+' | \

#- chg 2nd row "col span" to 1
#- copy text only to next cell to the right
#- move buttons to former heading cell (2nd row, 1st col)
sed 's+<td width="175" bgcolor="#009999" nowrap align="left" height="450" valign="top"><csobj.*</td>$[[:space:]]*<td bgcolor="white" +<td bgcolor="white" +' | \

sed 's+<td bgcolor="#009999" colspan="2">+<td bgcolor="#009999" width="160" rowspan="2" valign="top"><div align="left">$<csobj w="160" h="276" t="Component" csref="../../Rigi.data/Components/navigation.html" occur="0">$<table cool width="151" height="271" border="0" cellpadding="0" cellspacing="0" gridx="16" showgridx usegridx gridy="16" showgridy>$<tr height="1" cntrlrow>$<td width="1" height="1"></td>$<td width="150" height="1"><spacer type="block" width="150" height="1"></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/hometest2.gif"><a href="../index.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00homeä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00homeä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/hometest1.gif" width="150" height="30" name="Cmp0055B61A00home" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/descrtest2.gif"><a href="description.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00descriptionä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00descriptionä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/descrtest1.gif" width="150" height="30" name="Cmp0055B61A00description" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/downtest2.gif"><a href="download.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00downloadä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00downloadä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/downtest1.gif" width="150" height="30" name="Cmp0055B61A00download" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/projtest2.gif"><a href="projects.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00projectsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00projectsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/projtest1.gif" width="150" height="30" name="Cmp0055B61A00projects" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/publtest2.gif"><a href="publications.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00publicationsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00publicationsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/publtest1.gif" width="150" height="30" name="Cmp0055B61A00publications" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/resotest2.gif"><a href="resources.shtml" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00resourcesä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00resourcesä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/resotest1.gif" width="150" height="30" name="Cmp0055B61A00resources" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/spontest2.gif"><a href="sponsors.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00sponsorsä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00sponsorsä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/spontest1.gif" width="150" height="30" name="Cmp0055B61A00sponsors" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/sitetest2.gif"><a href="siteinfo.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00site infoä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00site infoä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/sitetest1.gif" width="150" height="30" name="Cmp0055B61A00site info" border="0"></a></csobj></td>$</tr>$<tr height="30">$<td width="1" height="30"><spacer type="block" width="1" height="30"></td>$<td width="150" height="30" colspan="1" rowspan="1" valign="top" align="left" xpos="0"><csobj w="150" h="30" t="Button" ht="../Media/conttest2.gif"><a href="contact.html" onmouseover="return CSIShow\(/\*CMP\*/äCmp0055B61A00contact usä,1\)" onmouseout="return CSIShow\(/\*CMP\*/äCmp0055B61A00contact usä,0\)" onclick="return CSButtonReturn\(\)"><img src="../Media/conttest1.gif" width="150" height="30" name="Cmp0055B61A00contact us" border="0"></a></csobj></td>$</tr>$</table>$</csobj></div>$</td>$<td bgcolor="#009999">+' | \
tr 'ä' "'" | \

sed 's+<div align="left">$[[:space:]]*<table cool width="573" height="43" border="0" cellpadding="0" cellspacing="0" gridx="16" showgridx gridy="16" showgridy>$[[:space:]]*<tr height="1" cntrlrow>$[[:space:]]*<td width="1" height="1"></td>$[[:space:]]*<td width="8" height="1"><spacer type="block" width="8" height="1"></td>$[[:space:]]*<td width="376" height="1"><spacer type="block" width="376" height="1"></td>$[[:space:]]*<td width="188" height="1"><spacer type="block" width="188" height="1"></td>$[[:space:]]*</tr>$[[:space:]]*<tr height="2">$[[:space:]]*<td width="1" height="2"><spacer type="block" width="1" height="2"></td>$[[:space:]]*<td width="8" height="2"></td>$[[:space:]]*<td width="376" height="2"></td>$[[:space:]]*<td width="188" height="2"></td>$[[:space:]]*</tr>$[[:space:]]*<tr height="40">$[[:space:]]*<td width="1" height="40"><spacer type="block" width="1" height="40"></td>$[[:space:]]*<td width="8" height="40"></td>$[[:space:]]*<td width="376" height="40" colspan="1" rowspan="1" valign="top" align="left" xpos="8" content csheight="40">$[[:space:]]*<div align="left">++' | \
sed 's+</div>$[[:space:]]*</td>$[[:space:]]*<td width="188" height="40"></td>$[[:space:]]*</tr>$[[:space:]]*</table>$[[:space:]]*</div>++' | \

#- change heading font to size=6
sed 's+<font size="5"+<font size="6"+' | \

#- change to row span=2, alignment=top, col width to 160 pixels
sed 's+w="175" h="456"+w="160" h="276"+' | \

#- remove contents of 4th row, 2nd col cell
#- replace with "../../Rigi.data/Components/footer.html"

sed 's+<font size="2">$[[:space:]]*<hr>$[[:space:]]*\[<a href="../index.html">home</a>\] \[<a href="whatitis.html">what it is</a>\] \[<a href="howitworks.html">how it works</a>\] \[<a href="features.html">features</a>\] \[<a href="methodology.html">methodology</a>\] \[<a href="success.html">success</a>\] \[<a href="platforms.html">platforms</a>\] \[<a href="download.html">download</a>\] \[<a href="glossary.html">glossary</a>\] \[<a href="projects.html">projects</a>\] \[<a href="publications.html">publications</a>\] \[<a href="resources.shtml">resources</a>\] \[<a href="sponsors.html">sponsors</a>\] \[<a href="siteinfo.html">site info</a>\] \[<a href="contact.html">contact us</a>\]</font></center>+<font size="2"><csobj w="377" h="36" t="Component" csref="../../Rigi.data/Components/footer.html" occur="81">$<center>$<font size="2">\[<a href="../index.html">home</a>\] \[<a href="whatitis.html">description</a>\] \[<a href="download.html">download</a>\] \[<a href="projects.html">projects</a>\] \[<a href="publications.html">publications</a>\] \[<a href="resources.shtml">resources</a>\] \[<a href="sponsors.html">sponsors</a>\] \[<a href="siteinfo.html">site info</a>\] \[<a href="contact.html">contact us</a>\]</font></center>$</csobj></font></center>+' | \
sed 's+<font size="2">$[[:space:]]*<hr>$[[:space:]]*\[<a href="../../index.html">home</a>\] \[<a href="../whatitis.html">what it is</a>\] \[<a href="../howitworks.html">how it works</a>\] \[<a href="../features.html">features</a>\] \[<a href="../methodology.html">methodology</a>\] \[<a href="../success.html">success</a>\] \[<a href="../platforms.html">platforms</a>\] \[<a href="../download.html">download</a>\] \[<a href="../glossary.html">glossary</a>\] \[<a href="../projects.html">projects</a>\] \[<a href="../publications.html">publications</a>\] \[<a href="../resources.shtml">resources</a>\] \[<a href="../sponsors.html">sponsors</a>\] \[<a href="../siteinfo.html">site info</a>\] \[<a href="../contact.html">contact us</a>\]</font></center>+<font size="2"><csobj w="377" h="36" t="Component" csref="../../Rigi.data/Components/footer.html" occur="81">$<center>$<font size="2">\[<a href="../../index.html">home</a>\] \[<a href="../whatitis.html">description</a>\] \[<a href="../download.html">download</a>\] \[<a href="../projects.html">projects</a>\] \[<a href="../publications.html">publications</a>\] \[<a href="../resources.shtml">resources</a>\] \[<a href="../sponsors.html">sponsors</a>\] \[<a href="../siteinfo.html">site info</a>\] \[<a href="../contact.html">contact us</a>\]</font></center>$</csobj></font></center>+' | \
#
#- chg colour of 4th row, 1st col to aqua (009999)
sed 's+<td width="175" bgcolor="white">+<td width="160" bgcolor="#009999"><spacer type="block" width="1" height="1">+' | \

#- chg 3rd row, 2nd col height to 230 pixels
sed 's+ height="450"+ height="230"+g' | \
#
#- restore newlines
tr '$' '\n'