It seems AWK has problems开发者_C百科 with the unsigned hex format specifier:
echo 0x80000000 | awk '{printf("0x%08x\n", $1)}'
gives back: 0x7fffffff
Is this a known problem with awk?
Thanks!
The problem is that awk only converts input parameters to numbers automatically if they are decimal. But this should work:
echo 0x80000000 | awk '{printf("0x%08x\n", strtonum($1))}'
It's all explained in here, in the strtonum section: http://www.gnu.org/manual/gawk/html_node/String-Functions.html#String-Functions
Not seeing it here, although I wasn't able to use the hex input as you are, but converted to decimal was no problem.
$ echo 2147483648 | awk '{printf("0x%08x\n", $1)}'
0x80000000
If you care to enlighten us what platform you're on (this was GNU awk 3.1.5), we might be able to help you more.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论