I get some output from a command, I have to extract text between two patterns from the output. Start pattern is fixed. But the end format can be one of two (lets say word2-1 and word2-2).Is there any way I can specify that in a single sed command?I triedsed -n /Word1/,/(word2-1|word2-2)/psed -n /Word1/,/word2-1|word2-2/psed -n /Word1/,/word2-1\|word2-2/psed -n /Word1/,/[word2-1|word2-2]/p
sed extract with multiple options in end pattern
sed