On 2019-01-24 17:40, Michael Orlitzky wrote:
On 1/24/19 4:00 AM, Gerrit Kühn wrote:

---
[me@you ~]# ip=01.02.00.0004; for d in $(echo "${ip}"|tr '.' '\n');
do myip="${myip}"$(printf "%i" "${d}")"." ; done; echo ${myip%.}
1.2.0.4

That turns "010" into "8". Using a real programming language with a
parser is only heavyweight compared to solutions that don't work.

  $ ip=01.02.00.010; for d in $(echo "${ip}"|tr '.' '\n'); \
    do myip="${myip}"$(printf "%i" "${d}")"." ; done; echo ${myip%.}
  1.2.0.8
Really interesting _how_ people think. Find the error:

echo 01.02.00.010 | sed 's/\.0/\./g' | sed 's/^0//g' | sed 's/\.0/\./g' | sed 's/\.\./.0./g' | sed 's/^0//g'



--
Sent with eQmail-1.11 beta - a fork of djb's famous qmail

Reply via email to