I'm trying to extract from a large file lines located between two lines each of which is marked by a certain pattern, let's say pattern1 and pattern2. My code :
awk "/pattern1/{flag=1;next}/pattern2/{flag=0}flag" filename
verifies if "pattern1" exists in a line and start printing from that line until it finds a subsequent line in which the string "pattern2" exists.
What I would like to do is exactly matching the string "pattern1" with the line from which awk will begin printing, and detecting the line at which awk will stop printing by verifying if "pattern2" exists in the line (no exact matching). So basically, I would like to do exact matching for the first pattern and keep the matching behavior of the command above for the second pattern.