Hi,
I want to do a gawk statement were the following is matched but it does not work:
variable="partners";
temp="(partners ?x1 ?x2";
if ( temp ~ /^\(/variable/ ?/ ){
print hello;
}
The following works, so the problem is getting the variable value of "partners" inside the regexp.
if ( temp ~ /^\(partners ?/ )
I tried using match function instead, but keep getting errors, e.g:
if (match(temp,"^\("variable" ?") ){
I get the error:
gawk: ../../../scripts/Hikin-3Dto2D-PDDL.awk:147: fatal: :, [., or [=: /^(partners ?/
To summarize, can I do a search in gawk that uses both regexp "^" for beginning of string and also a variable as part of the string to match???
Thanks!
I want to do a gawk statement were the following is matched but it does not work:
variable="partners";
temp="(partners ?x1 ?x2";
if ( temp ~ /^\(/variable/ ?/ ){
print hello;
}
The following works, so the problem is getting the variable value of "partners" inside the regexp.
if ( temp ~ /^\(partners ?/ )
I tried using match function instead, but keep getting errors, e.g:
if (match(temp,"^\("variable" ?") ){
I get the error:
gawk: ../../../scripts/Hikin-3Dto2D-PDDL.awk:147: fatal: :, [., or [=: /^(partners ?/
To summarize, can I do a search in gawk that uses both regexp "^" for beginning of string and also a variable as part of the string to match???
Thanks!