: ########################################################################## # Shellscript: hilit - highlight text # Version : 0.1 (beta) # Author : Heiner Steven (heiner.steven@odn.de) # Date : 11/01/94 # Category : Text Utilities # SCCS-Id. : $Id: hilit,v 1.1.1.1 1999/06/15 19:29:05 heiner Exp $ ########################################################################## # Description # The following attributes are recognized: # *reverse* _underline_ ########################################################################## PN=`basename $0` # program name VER='0.1 (beta)' Usage () { echo "$PN - highlight text, $VER (stv '94) usage: $PN [file ...] $PN displays text attributes on the terminal, like *bold* and _underline_." >&2 exit 1 } Msg () { for i do echo "$PN: $i" >&2 done } Fatal () { Msg "$@"; exit 1; } while [ $# -gt 0 ] do case "$1" in --) shift; break;; -h) Usage;; -*) Usage;; *) break;; # First file name esac shift done : ${SMSO:="`tput smso`"} ${RMSO:="`tput rmso`"} : ${SMUL:="`tput smul`"} ${RMUL:="`tput rmul`"} # Always turn off text attributes at exit. trap 'echo -n $RMSO$RMUL' 0 sed -e ' s/^_\([a-zA-Z0-0][a-zA-Z0-0]*\)/'$SMUL'\1/g; s/\([ ][ ]*\)_\([a-zA-Z0-0][a-zA-Z0-0]*\)/\1'$SMUL'\2/g; s/_\([ ][ ]*\)/'$RMUL'\1/g; s/_\([\.\!\?]*\)$/'$RMUL'\1/g; s/^\*\([a-zA-Z0-0][a-zA-Z0-0]*\)/'$SMSO'\1/g; s/\([ ][ ]*\)\*\([a-zA-Z0-0][a-zA-Z0-0]*\)/\1'$SMSO'\2/g; s/\*\([ ][ ]*\)/'$RMSO'\1/g; s/\*\([\.\!\?]*\)$/'$RMSO'\1/g ' "$@"