SED replacement character

Source: Internet
Author: User

Sed-i s/"str1"/"str2"/g ' grep "str1"-rl--include= "config"./'

Replaces the str1 string in all config files in the current directory (including subdirectories) with the STR2 string.


Parameter explanation:
Sed:
-I represents the operation of the file, the ' ' enclosed grep command, which represents the result of the grep command as the action file
s/"str1"/"str2"/means to find str1 and replace with STR2, followed by G to indicate that there are multiple str1 in a row, instead of replacing only the first one

Grep:
-R means to find the current directory and all subdirectories
-L indicates that only qualified file names are listed, which are passed to the SED command for substitution operations
--include= "config" means to find only config file

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.