Re: how to reverse an IPv4, with awk

2023-04-30 Thread Geert Stappers
On Mon, May 01, 2023 at 02:24:18AM +0200, cor...@free.fr wrote: > Hello list, > > I wrote this script for reversing an IP: > > #!/bin/bash > > IP=$1 > > if [ -z $IP ];then > echo "$0 IP" > exit 1 > fi > > REVERSE=$(echo $IP|awk -F\. '{print $4.$3.$2.$1}') > echo $REVERSE > > > it won't w

Re: how to reverse an IPv4

2023-04-30 Thread David Wright
On Mon 01 May 2023 at 02:24:18 (+0200), cor...@free.fr wrote: > I wrote this script for reversing an IP: $ IP='12.34.56.78' $ sed -E 's/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/\4.\3.\2.\1/' <<<"$IP" 78.56.34.12 $ or REVERSE="$(↑↑↑that stuff↑↑↑)" Cheers, David.

Re: how to reverse an IPv4

2023-04-30 Thread Lee
On 4/30/23, cor...@free.fr wrote: > Hello list, > > I wrote this script for reversing an IP: > > #!/bin/bash > > IP=$1 > > if [ -z $IP ];then >echo "$0 IP" >exit 1 > fi > > REVERSE=$(echo $IP|awk -F\. '{print $4.$3.$2.$1}') > echo $REVERSE > > > it won't work as the output below. > > $ bin

Re: how to reverse an IPv4

2023-04-30 Thread Jeremy Ardley
On 1/5/23 08:24, cor...@free.fr wrote: Hello list, I wrote this script for reversing an IP: #!/bin/bash IP=$1 if [ -z $IP ];then   echo "$0 IP"   exit 1 fi REVERSE=$(echo $IP|awk -F\. '{print $4.$3.$2.$1}') echo $REVERSE it won't work as the output below. $ bin/rbl.sh 61.144.56.32 32561

how to reverse an IPv4

2023-04-30 Thread coreyh
Hello list, I wrote this script for reversing an IP: #!/bin/bash IP=$1 if [ -z $IP ];then echo "$0 IP" exit 1 fi REVERSE=$(echo $IP|awk -F\. '{print $4.$3.$2.$1}') echo $REVERSE it won't work as the output below. $ bin/rbl.sh 61.144.56.32 325614461 The "." was lost. If I changed the