Hi, there are several things incorrect in your awk program. Here's my interpretation of the syntax which (as I believe) fits your semantics.
Code:
awk 'BEGIN{FS="<tag_value1>|</tag_value1>"}
/myMatch/{
for(i=1;i<=NF;i++) {
if(var1 = var2)
print "<tag_value1>\(.*)</tag_value1>"
}
}
END {print $2}' var1=${xmlHelper} var2=${strHelper} file.xml
First: your -F flag is used to define an alternate fieldseparator and the same you did in the BEGIN section. You could use awk -F'<tag_value1>|<tag_value2>' and skip the BEGIN section.
Second: awk is a small though very own programming language. You can incorporate awk commands inside a shell script but not the other way around. So the syntax of your if-statement should be as described here, whith awk variables holding the expression values. How these variables recieve values form the invoking environment is shown on the last line. After the end bracket you specify the filename(s) to be processed by awk. If a filename has the form
var=text it is treated as an assigment of
text to
var at the time when that argument would otherwise be accessed as a file.
Regards