Created
September 13, 2012 14:10
-
-
Save hostmaster/3714556 to your computer and use it in GitHub Desktop.
busybox awk is not fully compatible with GNU awk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# busybox AWK implementation is not fully compatible with GNU AWK | |
# GNU awk | |
$ echo 3000592982016 | awk '{ printf "%d\n", $1/1024 }' | |
2930266584 | |
# busybox awk | |
$ echo 3000592982016 | awk '{ printf "%d\n", $1/1024 }' | |
-2147483648 | |
# The workaround is obvious use printf "%,0f" instead | |
$ echo 3000592982016 | awk '{ printf "%.0f\n", $1/1024 }' | |
2930266584 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment