I have 30+ text files that I want to remove specific lines of text from. They all have different names (which I need to keep), they are in the same folder. The text will not all be on the same line but will be identical.Some are single words, some are multiple lines. I have looked at various ways of doing this -but am at a bit of a loss. I've also looked at using macros (in LO) and python and am still stuck! I also have versions of these files as Libre office writer(.odt) but would rather use the text files ( I saved them as .txt to get rid of formatting etc)
I'm new to linux and have limited experience...and after much reading around I tried this in cli
first cd to the directory/folder containing the files
then sed -i.bak 'text to be deleted'/d'*
I tried this with one word and with several lines ( a paragraph) - nothing happened! I think I'm missing something!
Lots of what I've read mentions using line numbers or line starting with etc -but in my case (if possible) it would be better to use the text
A kind of find and replace, replace with nothing. I could open and do find and replace on each file but there is a lot of text I need to get rid of -it would several processes in each file.
Just thought I should also say some of the files don't contain all the text I am trying to get rid of.
Thanks for any help
sed -i.bak 's/text to be deleted//' *
.-i.bak
, just-i
.