#!/bin/ksh sed ' #Remove all characters except the digits. s/[^0-9]//g #If the line does not consist of exactly 9 digits, change it #to 9 question marks. See p. 110 and Handout 8, p. 6 for !. /^.........$/!s/.*/?????????/ #Insert the two dashes. s/^\(...\)\(..\)/\1-\2-/ ' exit 0