I want to search for PATTERN1, if found check the next line for PATTERN2, if PATTERN2 is found in the next line of PATTERN1 match; replace both PATTERN1 & PATTERN2.How to use sed or awk for this?Sample yaml file contents belowModules:  Java  tomcatpattern1:  - something goes here:    next linepattern1:  - pattern2 goes here    something is heretest_d:  - this is not needed    no need to check this outpattern1:  - no need to find mepattern1:  - pattern3 is here    pattern2 us here    you can ignore this lineIn the above sample I have to replace pattern1 & complete line where pattern2 begins, only when pattern2 is in the next line of pattern1.Thanks in advance.
sed/awk/grep question - Search Pattern 1 when a match is found check the next line for a pattern, if matched, replace both the lines
awk;sed