Just like last week, where we wanted to replace a string, we can use sed
for this task:
sed '/pouet/d' file.txt
This will output file.txt
on stdout without the lines containing pouet
.
On Linux systems, you can add the -i
option to delete the lines inplace.
On Mac systems you can use -i .bak
to also delete the lines inplace, but you need to tell how to name the backup of the original file (named file.txt.bak
in this example).