AWK and hex sequences

for file in `seq 1 256`; do printf "\x$file -- $file" ; done ; printf "\n"

produces the wrong output.
I want to show the ascii codes but need to output
a hexidecimal number sequence.
I know I should use awk to do this but i'm not sure how cause I forget.

what is the awk equivelant of seq 1 256?
how would I "seqhex 00 ff"?
????????????????????????????????????????????????????

try this :

#!/bin/ksh
for i in `cat numbers.txt | awk '{ print "10#"$0}'`
do
typeset -i16 i
echo $i | sed -e s/16\#//g
done

ps.: The file called numbers.txt, has decimal numbers.

I hope help you

Witt

not exactly what i'm looking for and it actually doesn't work on my system for some reason. oh well. thanks for the try.

It's not at all obvious what you do want. I've never heard of a program called seq nor seqhex.

If you want to show a files contents in hex you should be using something like "od -tx1".

If you're just trying to count in hex, try this:

#! /usr/bin/ksh
typeset -i16 i=0
while ((i <= 16#ff)) ; do
       echo ${i#16#}
       ((i=i+1))
done
exit 0

If you want something else, describe the problem. Don't post code that we can't run and then ask us how to do the same thing in another language. And if someone gives you a solution, don't simply post "not exactly what I'm looking for". Take another crack at telling us what it is that you actually do want.

sure. i want to have a simple method of executing the output to an increment of 1 to 256 but in hexidecimal numbers.
My question is how do I on the fly, convert
the ouput of "seq 1 256" to it's corresponding hexadecimal equivalents. that's all I need to know. Not wanting to know how to take a hexdump of a file, or number the lines of a file in hex or anything like that. I merely want to use the bash shell in combination with really whatever has to be used to generate a hexidecimal number sequence of 00 to FF.
If you can help please do so. Thanks for the help by the way. I appreciate it.

How about:

#! /usr/local/bin/bash
declare -i i=0
while ((i <= 16#FF)) ; do
      X=$(printf "%X\n" $i)
      echo ${X#0X}
      ((i=i+1))
done
exit 0