delete lines using sed Dec 1, 2021 • ulysses How to delete a line containing a pattern using sed. Contents of test.txt. $ cat test.txt one two three Delete a line matching the string “one.” sed -i '/one/d' test.txt Display test.txt $ cat test.txt two three