Output special characters-single quotes in AWK

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.