Hello,
I have been trying to write a script where I could get awk to delete data before and after a matched pattern.
For eg
Raw data
Start
NAME = John
Age = 35
Occupation = Programmer
City = New York
Certification Completed = No
Salary = 80000
End
Start
NAME = Mary
Age = 25
Occupation = Programmer
City = New York
Certification Completed = Yes
Salary = 90000
End
So I am looking to write a script with awk, which would exclude Johns records based on the pattern Certification Completed = No
However so far am only able to know how to remove data before the pattern as shown below
awk '/Certification Completed = No/{p=1}p' <file>
This gives
Certification Completed = No
Salary = 80000
End
Start
NAME = Mary
Age = 25
Occupation = Programmer
City = New York
Certification Completed = Yes
Salary = 90000
End
However what I am looking for is
Start
NAME = Mary
Age = 25
Occupation = Programmer
City = New York
Certification Completed = Yes
Salary = 90000
End
Basically removing all data between Start and End when the pattern is matched.
Thanks for your help in advance