I have a file like this:
@ IN NS ns1.riodomain.com.
@ IN A 192.175.3.255
@ IN MX 10 root@ns1.riodomain.com.
mail IN A 192.164.2.228
ns1 IN A 192.164.2.333
After executing i need to get as follows
@ IN A 192.175.3.255
@ IN MX 10 root@ns1.riodomain.com.
mail IN A 192.164.2.228
ns1 IN A 192.164.2.333
I need to remove the first line with specific pattern. Can anyone help?
According to your requirement(literally):
I need to delete line that start with @ and ends with string like riodomain.com. or 192.164.2.333
sed approach:
sed -i '/^@.*\(riodomain\.com\.\|192\.164\.2\.333\)$/d' file
Now, the file contents should look like:
@ IN A 192.175.3.255
mail IN A 192.164.2.228
ns1 IN A 192.164.2.333
-i
- option, to modify file in place
/d
- flag, tells to delete the lines matched the pattern