How to delete lines from file with sed\awk?
awk, bash, freebsd, linux, sed
Solution
Sed solution
sed -i '/<pattern-to-match-with-proper-escape>/d' data.txt
`-i` option will change the original file.
Awk solution
awk '!/<pattern-to-match-with-proper-escape>/' data.txt
Problem
I have file, with lines, contains ip with netmask a.b.c.d/24 w.x.y.z/32 etc How to delete delete specific row? i'm using ``` sed -ie "s#a.b.c.d/24##g" %filname% ``` but after the removal is an empty string in file. It should run inside a script, with ip as parameter and also work in freebsd under sh.