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.

    Like

  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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s