1*72fcea8cSEd Schouten#!/bin/sh 2*72fcea8cSEd Schouten 3*72fcea8cSEd Schoutenset -x 4*72fcea8cSEd Schouten 5*72fcea8cSEd Schoutenif [ $# -lt 2 ] 6*72fcea8cSEd Schoutenthen 7*72fcea8cSEd Schouten echo usage $0 source_file dest_file 8*72fcea8cSEd Schouten exit 1 9*72fcea8cSEd Schoutenfi 10*72fcea8cSEd Schouten 11*72fcea8cSEd Schoutentrap 'rm -f /tmp/$$.out; exit 0' 0 # set up traps to clean up 12*72fcea8cSEd Schoutentrap 'rm -f /tmp/$$.out; exit 1' 1 2 3 15 # on errors AND normal exit 13*72fcea8cSEd Schouten 14*72fcea8cSEd Schoutenif [ -f $2 ] 15*72fcea8cSEd Schoutenthen 16*72fcea8cSEd Schouten rm $2 17*72fcea8cSEd Schoutenfi 18*72fcea8cSEd Schouten 19*72fcea8cSEd Schoutencat $1 | grep 'catgetlocal.*\"*\"' | 20*72fcea8cSEd Schouten sed -e 's/^.*catgetlocal(//' | 21*72fcea8cSEd Schouten sed -e 's/^[ ]*//' | 22*72fcea8cSEd Schouten sed -e 's/, \"/ \"/' | 23*72fcea8cSEd Schouten sed -e 's/);//' > /tmp/$$.out 24*72fcea8cSEd Schouten 25*72fcea8cSEd Schoutencat > $2 <<EOF 26*72fcea8cSEd Schouten\$ 27*72fcea8cSEd Schouten\$ 28*72fcea8cSEd Schouten\$set 1 29*72fcea8cSEd Schouten\$quote " 30*72fcea8cSEd SchoutenEOF 31*72fcea8cSEd Schouten 32*72fcea8cSEd Schoutensort -n < /tmp/$$.out >> $2 33