Output special characters in AWK-single quotation marks output in AWK single quotation marks are implemented in a special way: [html]> uname Linux uses single quotation marks for output strings: single quotation marks-double quotation marks-single quotation marks-escape single quotation marks-string-single quotation marks-double quotation marks-single quotation marks (the underline part is the output single quotation marks, corresponding to the same color symbol) [html]> echo aaa | awk '{print "select * from A where name =' \ ''tom '\'' "} 'select * from A where name = 'Tom 'Use single quotes for output domain variables: single quotation marks-double quotation marks-single quotation marks-escape single quotation marks-double quotation marks-domain variables-double quotation marks-single quotation marks-escape single quotation marks-single quotation marks (the underline part is the output single quotation marks, corresponding to the same color symbols) [html]> echo TOM | awk '{print "select * from A where name =' \'' "$1" '\ ''"} 'select * from A where name = 'Tom: single quotation marks-double quotation marks-single quotation marks-escape single quotation marks-environment variables-single quotation marks-escape single quotation marks-single quotation marks (the underline part is the output single quotation marks, corresponding to the same color symbol) [html]> key = TOM; echo aaa | awk '{print "select * from A where name =' $ key'"} 'select * from A where name = TOM> key = TOM; echo aaa | awk '{print "select * from A where name =' \ ''' $ key'' \'' "} 'select * from A where name = 'Tom' other special characters: $ '(dollar sign, reverse quotation mark) only needs to be in double quotation marks, \ (backslash) add the backslash [html] echo aaa | awk '{print "$ \'"} '$ \' to the front \'