So, in linux, I have a folder with lots of big text files.
I want to delete all the lines of these files that contain a specific keyword. Is there any easy way to do that across all files?
There already many similar answers. I'd like to add that if you want to match this is a line containing a keyword
but not this is a line containing someoneelseskeyword
, then you had better added brackets around the word:
sed -i '/\<keyword\>/d' *.txt
I cannot test this right now, but it should get you started
find /path/to/folder -type f -exec sed -i '/foo/d' {} ';'
/path/to/folder
foo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With