**pattern1**
#unknown number of lines,/p>
***pattern2**
#unknown number of lines
**pattern1**
#unknown number of lines
**pattern2**
I want to search for each pattern 1 and print the first occurence of pattern 2. I formed an array with all pattern1 matches. Now the task is to print first occurence of pattern2 foreach pattern1. I can only think of a file handler approach which can stop scanning the file after finding the first pattern and then doing a zgrep -m 1 for the first pattern2 occurence from where file pointer stopped scanning. But my files are huge and in gzip format, so this approach wont work. Any ideas on how to go about it?
Appreciate any help out :)In reply to Searching a gzip file by baski
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |