I am trying to append /32 to public IP that is in a file using awk
ip.txt has IP address 4.14.XX.XXX
the issue is with the command in script file
awk "{print $0 "/32"}" < ip.txt
result=0.129375
if I remove /
than the result is 4.14.XX.XXX32
I want 4.14.XX.XXX/32.
The complete bat file
curl v4.ifconfig.co > ip.txt
awk "{ print $0 "/32" }" < ip.txt > ipnew.txt
@REM set stuff=type ipnew.txt
for /f %%i in ('type ipnew.txt') do set stuff=%%i
echo %stuff%
====================
awk -f changeipaddress.bat
error
awk: changeipaddress.bat:1: curl v4.ifconfig.co > ip.txt
awk: changeipaddress.bat:1: ^ syntax error
awk: changeipaddress.bat:1: curl v4.ifconfig.co > ip.txt
awk: changeipaddress.bat:1: ^ syntax error
awk: changeipaddress.bat:2: awk "{ print $0 "/32" }" < ip.txt > ipnew.txt
awk: changeipaddress.bat:2: ^ syntax error
awk: changeipaddress.bat:2: awk "{ print $0 "/32" }" < ip.txt > ipnew.txt
awk: changeipaddress.bat:2: ^ syntax error
awk: changeipaddress.bat:3: @REM set stuff=type ipnew.txt
awk: changeipaddress.bat:3: ^ invalid char '@' in expression
Please suggest where I am going wrong?
Regards, TJ.