172fcea8cSEd Schouten#!/bin/sh 272fcea8cSEd Schouten 372fcea8cSEd Schoutenset -x 472fcea8cSEd Schouten 572fcea8cSEd Schoutenif [ $# -lt 2 ] 672fcea8cSEd Schoutenthen 772fcea8cSEd Schouten echo usage $0 source_file dest_file 872fcea8cSEd Schouten exit 1 972fcea8cSEd Schoutenfi 1072fcea8cSEd Schouten 1172fcea8cSEd Schoutentrap 'rm -f /tmp/$$.out; exit 0' 0 # set up traps to clean up 1272fcea8cSEd Schoutentrap 'rm -f /tmp/$$.out; exit 1' 1 2 3 15 # on errors AND normal exit 1372fcea8cSEd Schouten 1472fcea8cSEd Schoutenif [ -f $2 ] 1572fcea8cSEd Schoutenthen 1672fcea8cSEd Schouten rm $2 1772fcea8cSEd Schoutenfi 1872fcea8cSEd Schouten 1972fcea8cSEd Schoutencat $1 | grep 'catgetlocal.*\"*\"' | 2072fcea8cSEd Schouten sed -e 's/^.*catgetlocal(//' | 2172fcea8cSEd Schouten sed -e 's/^[ ]*//' | 2272fcea8cSEd Schouten sed -e 's/, \"/ \"/' | 2372fcea8cSEd Schouten sed -e 's/);//' > /tmp/$$.out 2472fcea8cSEd Schouten 2572fcea8cSEd Schoutencat > $2 <<EOF 2672fcea8cSEd Schouten\$ 2772fcea8cSEd Schouten\$ 2872fcea8cSEd Schouten\$set 1 2972fcea8cSEd Schouten\$quote " 3072fcea8cSEd SchoutenEOF 3172fcea8cSEd Schouten 3272fcea8cSEd Schoutensort -n < /tmp/$$.out >> $2 33