I have the next bock of code in Vagrantfile:
node.vm.network 'private_network',
ip: ip_prefix + "#{index}",
nic_type: "virtio"
if additional_ifaces
additional_ifaces.each do |iface|
node.vm.network 'private_network',
ip: iface['ip'],
nic_type: "virtio"
end
end
I want to remove this block of code with the help of sed. Could you please help? P.S.: I don't want to use a range of line numbers for removal as long as content of file is being changed frequently.
I was trying to achieve it by using variable and pass it to sed, however it raises error about escaping:
$ sed -i "s/$l//g" Vagrantfile
sed: -e expression #1, char 38: unterminated `s' command
The content of variable is:
$ echo $l
node.vm.network \'private_network\', ip: ip_prefix \+ "\#\{index\}", nic_type: virtio \if additional_ifaces additional_ifaces\.each \do \|iface\| node\.vm\.network \'private_network\'\, \ip: iface\[\'ip\'\], nic_type: "virtio" end end