# Find and replace across several documents?

**URL:** <https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522>\
**Category:** Factual Questions\
**Created:** [December 3, 2008, 5:05pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522 "2008-12-03T17:05:45Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 5:05pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/1 "2008-12-03T17:05:45Z")

</div>

I want to replace a string of text by a different one over hundreds of text files (html). Is there a good automated way of doing it?

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [December 3, 2008, 5:34pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/2 "2008-12-03T17:34:52Z")

</div>

Do you have an HTML editor program like HomeSite, FrontPage, etc? I know that Visual Studio 6, Visual Studio .NET and most likely FrontPage have an option for “Find and replace in all open documents” or “find and replace in entire project”.

Homesite 4.5 has a “find and replace in all open documents” too. Or maybe it was all documents in folder. Something.

If you don’t have any of those tools, perhaps find a light HTML coding tool that will do it. I’d recomment [VS.NET](http://VS.NET) Express (free) but it’s clunky.

---

<div class="post-metadata">

**Author:** ![Pasta](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pasta](https://boards.straightdope.com/u/Pasta)\
**Post date:** [December 3, 2008, 5:45pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/3 "2008-12-03T17:45:19Z")

</div>

Are you in a Linux environment?

sed -i “s/my old text/my new text/g” \*.html

(Replace the “/” with something else if either string includes a “/”.)

---

<div class="post-metadata">

**Author:** ![Ximenean](https://avatars.discourse-cdn.com/v4/letter/x/aca169/32.png) [@Ximenean](https://boards.straightdope.com/u/Ximenean)\
**Post date:** [December 3, 2008, 5:47pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/4 "2008-12-03T17:47:04Z")

</div>

If it’s Windows, you probably don’t have grep or whatever, but there are numerous equivalents available. There are probably nice easy to use GUI utilities, but here’s a little command line tool called, um, FART (find and replace tool).

> **[FART - Browse Files at SourceForge.net](https://sourceforge.net/projects/fart-it/files/)**
>
> Find And Replace Text command line utility. New & improved version of the well-known grep command, with advanced features such as: case-adaption of…

So, make a new folder, put a copy of all the html files in it (in case anything goes wrong), put fart.exe in there too, open a command prompt, cd to the folder, and type in \*_fart .html “\<what you want to change\>” “\<what you want to change it to\>”_ .

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 5:47pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/5 "2008-12-03T17:47:29Z")

</div>

I am using Adobe GoLive 5.0 (prehistoric). It does have a sitewide F&R function, but it won’t replace tags, just text.

Will check [VS.NET](http://VS.NET) Express. Free is always good, although I would be willing to pay a reasonable price.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 6:01pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/6 "2008-12-03T18:01:13Z")

</div>

Tried FART but it isn’t working. Might be because it is a long string that includes plenty of quote marks.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 6:17pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/7 "2008-12-03T18:17:47Z")

</div>

Tried VS Express but it is a 77MB download! Is there anything lighter?

---

<div class="post-metadata">

**Author:** ![ZipperJJ](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/zipperjj/32/211_2.png) [@ZipperJJ](https://boards.straightdope.com/u/ZipperJJ)\
**Post date:** [December 3, 2008, 6:19pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/8 "2008-12-03T18:19:49Z")

</div>

[Ultraedit](http://www.ultraedit.com/downloads/ultraedit_download.html)?

---

<div class="post-metadata">

**Author:** ![Duckster](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/duckster/32/1244_2.png) [@Duckster](https://boards.straightdope.com/u/Duckster)\
**Post date:** [December 3, 2008, 6:20pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/9 "2008-12-03T18:20:33Z")

</div>

> [@Sapo](#):
>
> I want to replace a string of text by a different one over hundreds of text files (html). Is there a good automated way of doing it?

Use the freeware text editor [ConText](http://www.contexteditor.org/).

Works quite well.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 6:54pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/10 "2008-12-03T18:54:27Z")

</div>

ConText couldn’t handle the long string either.

UltraEdit worked like a charm.

Thanks to all for the prompt replies.

---

<div class="post-metadata">

**Author:** ![Pasta](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pasta](https://boards.straightdope.com/u/Pasta)\
**Post date:** [December 3, 2008, 6:59pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/11 "2008-12-03T18:59:02Z")

</div>

nevermind

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 7:00pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/12 "2008-12-03T19:00:22Z")

</div>

> [@Pasta](#):
>
> nevermind

oh, but I do. Pray tell. It might be useful to someone else.

---

<div class="post-metadata">

**Author:** ![Pasta](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@Pasta](https://boards.straightdope.com/u/Pasta)\
**Post date:** [December 3, 2008, 7:12pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/13 "2008-12-03T19:12:24Z")

</div>

Nope. Not generally.

I had posted that if you wanted, you could send me a zip file and I would affect the find/replace for you with the “sed” command above.

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 3, 2008, 7:14pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/14 "2008-12-03T19:14:54Z")

</div>

Oh. A very generous offer. Thank you so much.

---

<div class="post-metadata">

**Author:** ![Duckster](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/duckster/32/1244_2.png) [@Duckster](https://boards.straightdope.com/u/Duckster)\
**Post date:** [December 3, 2008, 11:56pm UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/15 "2008-12-03T23:56:22Z")

</div>

> [@Sapo](#):
>
> ConText couldn’t handle the long string either.

How long was that piece of string?

😃

Seriously, what did you find and replace, and with what?

---

<div class="post-metadata">

**Author:** ![Sapo](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sapo](https://boards.straightdope.com/u/Sapo)\
**Post date:** [December 4, 2008, 1:22am UTC](https://boards.straightdope.com/t/find-and-replace-across-several-documents/475522/16 "2008-12-04T01:22:36Z")

</div>

It was about this long.

I was replacing a dummy image with a Google AdSense code. It is not that long, but it seems that the multiple lines were messing it up. The ConText window accepts only one line while UltraEdit has a multiline text field.
