How to use variables in search pattern in gensub function of awk
I am doing a small project where I have to parse different type of logs.I am using awk for the same.Suppose I have a variable which contains the search pattern , how do I use it in gensub function
Say I am now using this to extract the words after EXCEPTION and FAILED
Now I have to store this search pattern in a variable so that I can modify later.So even if log syntax changes a little bit ,my code should work provided the search pattern in variable is changed.
Can I use variables in first parameter of gensub?Thts my main question..
Plz help me
Thanks in Advance