i have such awk working fine but how to use variable instead of strings
awk '/asdasd.*asda.*asdasd/' file2.txt
This is not working:
awk '/${a}.*${b}.*${c}/' file2.txt
Thanks & regards
Peter
i have such awk working fine but how to use variable instead of strings
awk '/asdasd.*asda.*asdasd/' file2.txt
This is not working:
awk '/${a}.*${b}.*${c}/' file2.txt
Thanks & regards
Peter
Replace the single quotes with double quotes.
Thanks, it's working
One more help needed.
how to simulate in awk grep -i [ not case sensitive search ]
???
awk "/${a}.*${b}.*${c}/" file2.txt
Regards
Peter
if your awk version has the IGNORECASE variable, you can set it in your script.
Thanks i have
One more
this is working:
ps -ef | awk -v level=250 -v inst=1 '/ifstart.*turuat1/ { nr++; if ($4 > max ) {max=$4}}; END { if ( nr != inst ) {r=1} else {if ( max > level ) r=2 }; print r }'
but in double cords with variables not:
ps -ef | awk -v level=250 -v inst=1 "/${p}.*${w}/ { nr++; if ($4 > max ) {max=$4}}; END { if ( nr != inst ) {r=1} else {if ( max > level ) r=2 }; print r }"
ERROR:
syntax error The source line is 1.
The error context is
/ifstart.*turuat1/ { nr++; if ( >>> > <<< max ) {max=}}; END { if ( nr != inst ) {r=1} else {if ( max > level ) r=2 }; print r }
awk: The statement cannot be correctly parsed.
The source line is 1.
WHY ?
Regards
Peter
If i move awk prog to file i have now such error:
ps -ef | awk -f proc.awk -v level=250 -v inst=1 "/${p}.*${w}/"
awk: Cannot find or open file /ifstart.*turuat1/.
The source line number is 1.