Searching a file for multiple patterns recursively with IF condition
Lets say we have three strings Str1, Str2 and Str3 among many other strings in a huge file.
Str1, Str2 and Str3 can occur multiple times in the file.
But Str2 and Str3 occurs only after Str1. The pattern would be something like
Str1
Str2
Str3
Str1
Str2
Str3
So, I need to search this file for Str1, whenever this occurs, I need to search for Str2 and Str3 until I find Str1 then again I need to search for Str2 and Str3 and this repeats till the end of the file.
I have used SED, AWK and GREP for simple search. I have already spent some time and read about RE and understood a bit of it but this seems to be complex
Last edited by kk2018; 11-02-2018 at 03:42 AM.
|