Test Hexadecimal number

Hi,

I would like test if a number (with 2 digit, for example a9 , 0b ) is a hexadecimal number with 2 digit ?

Maybe something like this ?

$
$ cat -n f1
     1  1234
     2  a9
     3  0b
     4  4AF980
     5  23xy9
     6  abcdef
     7  F9
     8  ffffff
     9  aaaaaa
    10  0
    11  -982f
    12  ff
    13  aa
    14  -1
    15  34
    16  -34
    17  a!b!c!
    18  9F
$
$ # pick two digit hexadecimal integers from f1
$ perl -lne 'chomp; print if (/^-*([0-9a-fA-F]+)$/ and length($1)==2)' f1
a9
0b
F9
ff
aa
34
-34
9F
$
$

tyler_durden

thanks,

how i can do that with korn shell ?