Linux Tip: Search & Replace text in multiple files recursively

Here is how to find and replace text across multiple files recursively.

The following command will recursively find all files with extension .html starting with the current folder. In each file, the text apple will be replaced with orange.

find . -name "*.html" -print | xargs sed -i 's/apple/orange/g'

4 thoughts on “Linux Tip: Search & Replace text in multiple files recursively

  1. You want to be sure that you take the time that you need to understand how you are going to receive.
    The majority of the advantages which one gains while exploiting
    these buildings. For once, given steel building used for sale that they are tough.
    Arena buildings have always been a popular means
    for creating a space from which to run your business.

    Liked by 1 person

  2. I like the helpful information you provide in your
    articles. I will bookmark your weblog and check again here
    frequently. I am quite sure I will learn many new stuff
    right here! Best of luck for the next!

    Like

  3. Do you mind if I quote a couple of your articles as long as I provide
    credit and sources back to your website? My website is in the
    exact same niche as yours and my visitors would really benefit from
    a lot of the information you present here. Please let me
    know if this okay with you. Appreciate it!

    Like

Leave a comment