printf "%0Xd\n" を使用する

$ printf "%05d\n" 99
00099

numbers - How to zero pad a sequence of integers in bash so that all have the same width? - Stack Overflow