Convert decimal notation to ANSI point code notation

wondering if anyone has any thoughts to convert the below thru a shell script

Convert decimal signalling point notation to ANSI point code notation

There is a site that does that conversion but i need to implement the solution in a shell script.....Thoughts....

OS: Solaris 9

Example:

From Dec: 1254784
To ANSI: 19-37-128

This should get you started modulo any issues with an older Kshell you may have installed. The script accepts either a decimal SS7 point address in the form of a b c or a decimal value from the command line and computes the alternate form. Hex values are also presented.

#!/usr/bin/env ksh
case $# in
    1)
        v=$1
        c=$(( $v % 256 ))
        v=$(( $v / 256 ))
        b=$(( $v % 256 ))
        a=$(( ($v / 256) % 256 ))
        printf "%d-%d-%d (%02x-%02x-%02x)\n" $a $b $c $a $b $c
        ;;

    3)  v=$(( (65536*$1) + (256*$2) + $3 ))
        printf "%d  %x\n" $v $v
        ;;

    *)  echo "usage: $0 a b c"
        echo "OR"
        echo "  $0 a"
        exit 1
        ;;
esac
exit

A couple of samples (t16 is my script name):

spot: t16 190 100 29
12477469  be641d
spot: t16 2 109 20  
158996  26d14
spot: t16 123456  
1-226-64 (01-e2-40)
spot: t16 980321
14-245-97 (0e-f5-61)

Have fun.

Simple way.. Change the obase value as (2,4,8,16,32,...) in 2 powers . Highlighted is the decimal value.

% echo 'obase=16;980321' | bc
EF561

Bravo..........Genius..... agama..Thank you so much for your reply... Much ..Much Appreciated............aavam

---------- Post updated at 12:34 PM ---------- Previous update was at 12:26 PM ----------

agama...i see two addiotnal files declare and decryptdir when i tab at my scriopt name.......i don't see those files when i do ls -al.... thoughts/suggestions... Thank you again for your time and support......aavam

I assume you're using tab command/filename completion from the command line. Unfortunately I cannot help you on that one... I don't use it so I'm not really sure what it's scope is.