How to delete a line containing a pattern using sed.
Contents of test.txt.
<pre lang="bash">
$ cat test.txt
one
two
three
Delete a line matching the string “one.”
<pre lang="bash">
sed -i '/one/d' test.txt
Display test.txt
<pre lang="bash">
$ cat test.txt
two
three