The following example converts an IP address to hex: $ echo 192.197.96.12 | awk -F . \ '{ printf "%02X%02X%02X%02X\n", $1, $2, $3 ,$4 }'