Hello all,
I need to print all the lines before a specific string and print a custom message 2 lines after that.
So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message.
My code thus far is:
'{a[NR]=$0} ($3 ~ "Bob") {for(x=1; x<=$1; x++) {print a[x]}}'
My data is similar to the following:
Don|Joe|Lue
Mary|Elane|Bob
David|Mark|Steven
John|Jim|William
Sal|Jose|Michael
I would like to get the following result once "Bob" is matched:
Don|Joe|Lue
Mary|Elane|Bob
David|Mark|Steven
John|Jim|William
STOPPING HERE #This being the custom message
Thanks in advance