: ########################################################################## # Shellscript: unquote - undo "quoting" of a text # Versionsnr : 0.1 (beta) # Author : Heiner Steven (heiner.steven@odn.de) # Date : 11/01/94 # Category : Mail, Text Utilities # SCCS-Id. : $Id: unquote,v 1.1.1.1 1999/06/15 19:29:05 heiner Exp $ ########################################################################## # Description # Removes any leading " >" from stdin, and writes to stdout. # # Example: # The following two lines # | > this is a quoted text # | > and this too # become # |this is a quoted text # |and this too # (The vertical bar denotes the left margin). ########################################################################## PN=`basename $0` # program name VER='0.1 (beta)' Usage () { echo "$PN - short description, $VER (stv '94)" exit 1 } Msg () { for i do echo "$PN: $i" >&2 done } Fatal () { Msg "$@"; exit 1; } # swap stdout and stderr nawk ' $1 ~ />/ { while ( $0 ~ /^[ ]*>/ ) { if ( QStr == "" && match ($0, "^[ ]*>") ) Q = Q substr ($0, RSTART, RLENGTH) sub ("^[ ]*>[ ]*", "") # remove all quotes } if ( QStr == "" ) QStr = Q } {print} ' "$@"