[Sed] record

Source: Internet
Author: User

Sed Brackets have no special meaning. If you want to retain the wildcard content, you need to escape it.

Echo "1) Host" | SED's/1) ([A-Z])/$1) $1 /'

There are two problems.

1. First of all, it is the problem mentioned above. The above means to match the string 1) (B) without the significance of variable capture, so the $1 next to it is not a variable.

2. Replace the previously captured content with SED and save it directly in a numeric variable, instead of using characters similar to $1 $2. Therefore, Part 1 represents the content in the first parentheses.

But 1 itself represents the number 1, so it needs to be escaped.

Correct syntax:

Echo "1) Host" | SED's/1) \ ([A-Z] \)/\ 1) \ 1 /'

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.