Sed simple use (iii) Replace

Source: Internet
Author: User

SED usage record. Text substitution

0. test file content

1. Remove leading whitespace characters

2. Delete trailing whitespace characters

I don't see the effect.

3. Remove leading and trailing whitespace characters

Trailing delete or not see the effect

4. Insert 5 spaces at each line of the switch

5. Align text to the right by 79 character widths

It doesn't appear to be right-aligned because there are spaces or tabs behind it.

6. Center the contents of the file, with a width of 79 characters

7. Find the character and replace the found string with the specified string

A. Replace only the first matching string in each row

B. Replace only the second matched string in each row

C. Replacing all matching strings in each row

D. Replacing the second-to-last match

E. Replacing the last occurrence

8. Processing only in rows where a particular string appears

A. Replacing a string

B. Not appearing when a specific string is replaced

9. Multiple matching replacements

Replace ":/", ":", "/" with "="

Sed simple use (iii) Replace

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.