#!/bin/bash echo "Content-type: text/html" echo "" FILE=$QUERY_STRING xml_next () { local IFS='>' read -d '<' TAG VALUE } TITLE="Blog post" cat < EOT cat $FILE | while xml_next; do if [ $TAG = "h1" ]; then TITLE=$(echo $VALUE | cut -d "-" -f 4) echo ''$TITLE'' break fi done cat <

EOT cat $FILE cat <
EOT