badix = index($0," 47") - this does not find it
badix = index($0, "'") - throws a fit
badix = index($0, "'") - throws a fit
badix = index($0, ') - throws a fit
This applies to awk on Solaris 10, so in The gawk solution is not applicable in this case.
Any suggestions?
awk $'{
# Lots of other awk code...
badix=index($0, "'") }'
# The rest of the awk code
}'< /pre>
I have a line and I want to know if there are any embedded single quote characters in it. Using awk, I tried several variations
badix = index($0," 47") - this does not find it
badix = index($0, "'") - throws a fit
badix = index($0, "'") - throws a fit
badix = index($0, ') - throws a fit
This applies to awk on Solaris 10. , So the gawk solution is not applicable in this case.
Any suggestions?
You have a shell quoting problem, I suspect you are using single quotes to enclose the awk command, even if you escape it, you cannot include single quotes. Try $'... 'Quotation, which can contain escaped single quotes:
awk $'{
# Lots of other awk code...
< br /> badix=index($0, "'") }'
# The rest of the awk code
}'
p>