Keep lines containing “list of different words” like pattern [duplicate]
0
This question already has an answer here:
How to make sed remove lines not matched by a substitution
4 answers
Boolean OR in sed regex
4 answers
How can I keep all lines matching all those words toto OR titi OR clic OR SOMETHING and delete any other lines? If I do sed '/toto/ p ' file I cannot select titi for example. What I am looking for is something similar to a Perl Regular expression as ^ (word1|word2|word3|andsoon).* . However, I need it for sed because it will be integrated into a bigger sed script. The goal is to keep all lines starting with word where word is any word from a set of word...