|
|
ip2dec - various - Various utilities developed at bitreich. |
|
|
 |
git clone git://bitreich.org/various/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/various/ (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
|
--- |
|
|
|
ip2dec (253B) |
|
|
|
--- |
|
|
|
1 #!/bin/sh |
|
|
|
2 # |
|
|
|
3 # Convert IPv4 to decimal IPv4. |
|
|
|
4 # |
|
|
|
5 |
|
|
|
6 if [ $# -lt 1 ]; |
|
|
|
7 then |
|
|
|
8 printf "usage: %s ipv4addr\n" "$(basename "$0")" >&2 |
|
|
|
9 exit 1 |
|
|
|
10 fi |
|
|
|
11 |
|
|
|
12 ipv4addr="$1" |
|
|
|
13 |
|
|
|
14 printf "%s\n" "${ipv4addr}" \ |
|
|
|
15 | awk -F "." '{ printf "%d\n", (16777216*$1)+(65536*$2)+(256*$3)+$4 }' |
|
|
|
16 |
|