Skip to content

Instantly share code, notes, and snippets.

@haad
Created May 3, 2012 08:26
Show Gist options
  • Save haad/2584354 to your computer and use it in GitHub Desktop.
Save haad/2584354 to your computer and use it in GitHub Desktop.
convert mask variable in hex notation to dotted notation in plain ksh
mask=$(echo $a | sed 's/^0x//g;s/\(..\)/\1\,/g;s/,$//g;'| tr ',' '\n' | while read w; do printf ".%d" 0x$w; done|sed -e 's/^\.//');echo "Netmask $a converted to dotted notation is $mask";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment