The awk, sed command for Linux

Source: Internet
Author: User

Summary: The regular expressions for the two commands are distinguished by ' single quotation marks.

The output variable name is quoted in single quotes, and the output variable value is quoted in double quotes, which is generally common in bash scripts.

To use a variable value in a bash script, enclose the double quotation mark

awk usage:

Reference URL: http://www.cnblogs.com/xudong-bupt/p/3721210.html

Command form:

awk [-f|-f|-v] ' begin{}//{command1; Command2} end{} ' file

Separate the Product_uuid line with "=" to display the second parameter content

Awk-f "=" '/product_uuid/{print $ '/etc/save_env

SED usage:

Reference URL: http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html

sed [-nefri] ' command ' file

Note: If you want to replace the source file content directly without the screen output, add the option-I, which is sed-i

Example: Delete the line contents of Ipguard beginning in the file installed.db

Sed-i '/ipguard/d ' setup/installed.db

The awk, sed command for Linux

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.