Hi,
I am using gawk and give a variable filled with a string to awk like:
Infile looks like:
This way it never matches any of the patterns as it interprets it like /^hello$/ or /^yes$/ or /^no$/.
I want it to interpret it like /hello/ or /yes or /no/ so the pattern can be anywhere inside $3.
Thanks in forward.
laters
zaxxon
I am using gawk and give a variable filled with a string to awk like:
Code:
LIST="hello yes no"
for $ELE in LIST; do
awk -v var=$ELE '
$3 ~ var {print $3}' infile
done
Infile looks like:
Code:
112 3321 xxxxxhelloxxxx
3253 35 xxxxnoxxxx
753 3823 helloxxxxxxx
7123 430743 xxxxxyes
81 85311 xxxxxxxxhello
This way it never matches any of the patterns as it interprets it like /^hello$/ or /^yes$/ or /^no$/.
I want it to interpret it like /hello/ or /yes or /no/ so the pattern can be anywhere inside $3.
Thanks in forward.
laters
zaxxon