#!/bin/sh # http://berklix.com/~jhs/src/bsd/jhs/bin/public/phone/phone_reverse # Example: cat *.gnokii | phone_reverse # Author jhs@@berklix.com # Developed & tested on FreeBSD-7.1 (Noted as Awks vary.) DATE=`date "+%Y_%m_%d_%H_%M_%S"` cat | awk -F '\;' '{printf "%s;%s;%s\n",$1,$2,$5}' | sort | uniq | \ sed -e 's/;0$/;family/' | sed -e 's/;1$/;urgent/' | \ sed -e 's/;2$/;social/' | sed -e 's/;3$/;business/' | \ sed -e 's/;4$/;club/' | sed -e 's/;5$/;default/' | \ awk -F '\;' '{printf "bn:%s\ntn:%s\ncg:%s\n][\n",$1,$2,$3}' > $DATE.phone # Now convert back again to gnokii format. # 14 is just to preserve compatibility for gnokii writing to SIM cards. # SIM cards will actually take 16 phone -s 230 -g -n -1 -w 14 $DATE.phone > $DATE.gnokii