I have been researching how to add text to a line in file.
so the line I have in the text file looks like this
hosts allow = 192.168.122. 172.24.0
i want to add IP so line looks like
hosts allow = 192.168.122. 192.12.0. 172.24.0
Through trial and error I only have:
sed -i '/allow/ s/.*/&,192.12.0./' testfile
which gives:
hosts allow = 192.168.122. 172.24.0. 192.12.0.
sed
command would not produce the line that you mention. Where did the comma go? – Kusalananda Sep 18 '17 at 18:25