I have a problem. I want to write an IP into a file with sed
newsource=1.2.3.4/24
sed -i 's/.*#source*/&\n'"$newsource"'/' file
$newsource is an IP, which CAN contain a net-mask /24 or not. Right now the sed writes the full IP but not the /24. How can I change that?