{
awkvar2="/id=22/";
awkvar3="/end/";
if ($0 ~ awkvar2) {
triggered=1;
}
if (triggered) {
print;
if ($0 ~ awkvar3) {
triggered=0;
print "\n-----------------------------------------------\n"
}
}
}
this awk script does not work for me, I try to search from one line to another ie id=22until end
(the reason I do not use /<string>/,/<string>/it is because I want a large line after each search block) and I want this to use only variables. I could use templates directly if ($0 ~ /end/) {
but I donβt want to do this, I want to use variables inside the search template (the reason is that I will get values ββin variables that dynamically fill the shell)
please tell me how to use variables in awk search pattern
thank...
Omkar source
share