Bash – single quotes of characters AWK scan string

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 in 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 though Escaping also cannot contain single quotes. Try $’…’ quotation, which can contain escaped single quotes:

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
}'

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5485 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.