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 work as the output below. > > $ bin/rbl.sh 61.144.56.32 > 325614461 > > > The "." was lost. > > If I changed the awk line to: > REVERSE=$(echo $IP|awk -F\. '{print "$4.$3.$2.$1"}') > > > It becomes: > > $ bin/rbl.sh 61.144.56.32 > $4.$3.$2.$1 >
Make / mark the dot as string with " character. |$ echo 44.33.2.1 | awk -F\. '{print $4 "." $3 "." $2 "." $1}' |1.2.33.44 |$ > Can you help with this? I tent to ignore yes-no-questions. Groeten Geert Stappers -- Silence is hard to parse