I have a file iplist.txt with contents:
1.2.3.4
127.0.0.1
192.168.1.0/24
1111:2222:3333:4444::
5.6.7.8
im trying to find a way out to export a new file WITHOUT IPv6 and with prefix on every line something like that:
exportediplist.txt
/ip add address=1.2.3.4
/ip add address=127.0.0.1
/ip add address=192.168.1.0/24
/ip add address=5.6.7.8
the first thing i`ve tryied to do is to add a prefix with:
originalfile=/somepath/iplist.txt
exportedfile=/somepath/exportediplist.txt
sed -e 's#^#/ip add address=#' $originalfile > $exportedfile
and it works ok but i cant figure out how to remove IPv6 from file. It
s not important to use sed, just anything that works with debian.