Bulk find and replace text on Mac via Linux command line

Source: Internet
Author: User
Tags sublime text

Generally in the local computer bulk replacement text There are many tools can do, such as emeditor,sublime text, but the relevant editor on Linux and Mac has this feature, and most of the server is no graphical interface, so collected a few for Linux command line memo To implement commands for bulk replacement of text content:

  • Bulk find what's contained in a file

    grep -rn "要找查找的文本" ./

  • Bulk find and Replace file content with sed.

sed -i "s/要找查找的文本/替换后的文本/g"Grep-rl "Looking for text to find".

  • Find by combining the Find and grep commands
    find /etc -name ‘*‘ | xargs grep ‘hello abcserver‘

Bulk find and replace text on Mac via Linux command line

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.