I need to grep for a pattern and once I find it, I need to look for another pattern preceding that and print all those lines in between those.Better example:1 a2 a3 a4 a5 a6 b7 c8 d9 xyz10 xyz11 a12 aGrep for xyz and then grep for first a preceding xyz line and print all the lines.Output (first preceding occurrence of a, I don;t care about other a's in the file):5 a 6 b7 c8 d9  xyz10 xyz
Search a pattern and print preceding lines starting with another pattern
text processing;grep