#!/bin/ksh. . . various stuff in shell language . . .
echo "vprinter=${PRINTER:-ibm4029}\012 `cat ${SYSTEMFILE}`" | awk ' /.*/ { if ( $1 ~ /vprinter=/ ) { printer = substr( $1, ( index( $1, "=" ) + 1 ) ); } else { outline=$0; if ( $1 ~ /\[Printers\]/ ) { printer_sec_found=1; } else if ( printer_sec_found == 1 ) { if ( $1 ~ /^\[.*\]/ ) { printer_sec_found=0; } else if ( $1 ~ /^.*=.*/ ) { if ( noted == 0 ) { outline=sprintf("%s=%s.ini", printer, printer ); noted=1; } else outline=""; }; }; if ( $1 ~ /^DefaultPrinter=.*/ ) { outline=sprintf("DefaultPrinter=%s", printer ); }; print outline; } } ' > ${TMPFILE} && mv ${TMPFILE} ${SYSTEMFILE}shell program continues to its end . . .