Warning

 

Close

Confirm Action

Are you sure you wish to do this?

Confirm Cancel
Member Login

Site Notices
Posted: 3/15/2005 12:59:36 PM EST

Is there a way to batch replace a paragraph of identical text in a bunch of .txt files?

I have about 200 .txt files that all have a portion of identical text that needs to be replace with the identical replacement text.

I can do it by brute-force, open-C&P-save into each file but I have to open each of the 200+ txt files one at a time to do it.

Is there a faster way to do it in one batch?

Link Posted: 3/15/2005 1:09:25 PM EST
[Last Edit: 3/15/2005 1:10:20 PM EST by Cereal-Killer]
I can't think of an import/export feature off the top of my head. But you could probably edit all those files with a Unix script.
Link Posted: 3/15/2005 1:13:35 PM EST
Maybe with "finda and replace"
Link Posted: 3/15/2005 1:46:07 PM EST
[Last Edit: 3/15/2005 1:47:23 PM EST by The_Macallan]
Bumped.

Is this that mythical creature that we've all heard tales of, but never saw with our own eyes?

The question that ARFCOM can't answer?

Link Posted: 3/15/2005 2:02:43 PM EST
What OS are you running? The suggestion above to use UNIX would be a big help. You could use a shell script to do a find and replace on all the files. In WINDOWS I think you'd have to use MSWORD and write a macro in VBA. Tagged so give more detail about your environment and the tools you have access to and we'll try to help more.
Link Posted: 3/15/2005 2:04:55 PM EST
There's a way to use Access to create a database of Names/Phone #s/Addresses and inject them into a template (letter).


Been awhile since I've did it, so I can't remember how to exactly. All I know is that is how letters are made for people that get a lot of them. You could easily do 1,000 letters an hour.
Link Posted: 3/15/2005 2:05:13 PM EST
If you can access them via a unix shell, then probably, you can use a text editing command against a directory....but Im not the guru.

In Windows, with plain old .txt files....hmmm....sorry, cant think of anything.
Link Posted: 3/15/2005 2:06:19 PM EST

Windows XP.

Don't have MSWord. Have WordPerfect Office 11.

Link Posted: 3/15/2005 2:08:43 PM EST
VBA...

Visual Basic for Applications, ie Macros are built into Word. Its a rudimentary object oriented programming language that lets you program word to perform tasks just like that.

go to the directory where the files are. do a dir *.txt >> filelist.txt.

That'll create a list of files. Or you can use the FileSystemObject in VBA to access files.

Just write your code to do the search & replace you want. VBA is really easy to learn, but the debug support is a little crude. There is a lot of documentation on VBA though.

Good luck. Some wiz here may be able to help you.

Link Posted: 3/15/2005 2:18:41 PM EST
[Last Edit: 3/15/2005 5:05:14 PM EST by Halfcocked]

Originally Posted By The_Macallan:
Bumped.

Is this that mythical creature that we've all heard tales of, but never saw with our own eyes?

The question that ARFCOM can't answer?




Oh, It can be answered!

You just won't like the answers.


...Is there a way to batch replace a paragraph of identical text in a bunch of .txt files?

....

Is there a faster way to do it in one batch?....



The answer...No. Not using Word perfect or Microsoft Word. Any document minipulated using these programs must be opened first.


Open all 200 documents first then EDIT; REPLACE. Enter what you want to replace in the "Find" bar, what you want to replace it with in the "Replace" bar.


Link Posted: 3/15/2005 2:20:32 PM EST
[Last Edit: 3/15/2005 2:32:03 PM EST by Halfcocked]
If you place all 200 files in one folder you can open them all at once by holding the control key and highlight them all, then hit open. Then do what I out lined above.
Link Posted: 3/15/2005 2:21:27 PM EST
[Last Edit: 3/15/2005 2:21:55 PM EST by Halfcocked]
You better have one hell of a computer. Try it with like 10 files first maybe.
Link Posted: 3/15/2005 2:22:44 PM EST
XP comes with Microsoft Word, XP Pro anyway.
Link Posted: 3/15/2005 2:25:47 PM EST

Originally Posted By Halfcocked:
XP comes with Microsoft Word, XP Pro anyway.


Just XP. No MSWord.

Thanks. I think I'll try a small batch the way you said.

Wish me luck.
Link Posted: 3/15/2005 4:51:59 PM EST
www.openoffice.org

Here you can download free versions of MS WORD, EXCEL, POWER POINT, and other for FREE!!! There are some differences but for normal usage it is all the same and its FREEEEEEE!!!!!! Give it a try. I'll never buy MS OFFICE again after this!!!
Link Posted: 3/15/2005 4:54:52 PM EST
Macallan...

I used to be really good with DOS batch file processing, and this could be done with some work if I recall correctly.

Top Top