I wish to use sed to modify the starting and ending pattern of a code with odd/even occurrences in block/para, for e.g.
Word1 ..... Word1 Word1 ..... Word1
with replacing "word1" in the beginning with "NewWord1"(odd times, 1,3,5,7,..) and replacing "word1" in the end with "NewWord2"(even times, 2,4,6,...)
NewWord1 ..... NewWord2 NewWord1 ..... NewWord2
If you are working with paragraphs, then Awk or Perl are probably simpler
Ex. with GNU Awk: