Warning

 

Close

Confirm Action

Are you sure you wish to do this?

Confirm Cancel
BCM
User Panel

Posted: 3/15/2005 1:59:36 PM EDT

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 2:09:25 PM EDT
[#1]
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 2:13:35 PM EDT
[#2]
Maybe with "finda and replace"
Link Posted: 3/15/2005 2:46:07 PM EDT
[#3]
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 3:02:43 PM EDT
[#4]
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 3:04:55 PM EDT
[#5]
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 3:05:13 PM EDT
[#6]
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 3:06:19 PM EDT
[#7]

Windows XP.

Don't have MSWord. Have WordPerfect Office 11.

Link Posted: 3/15/2005 3:08:43 PM EDT
[#8]
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 3:18:41 PM EDT
[#9]

Quoted:
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 3:20:32 PM EDT
[#10]
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 3:21:27 PM EDT
[#11]
You better have one hell of a computer.  Try it with like 10 files first maybe.
Link Posted: 3/15/2005 3:22:44 PM EDT
[#12]
XP comes with Microsoft Word, XP Pro anyway.
Link Posted: 3/15/2005 3:25:47 PM EDT
[#13]

Quoted:
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 5:51:59 PM EDT
[#14]
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 5:54:52 PM EDT
[#15]
Macallan...

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

Close Join Our Mail List to Stay Up To Date! Win a FREE Membership!

Sign up for the ARFCOM weekly newsletter and be entered to win a free ARFCOM membership. One new winner* is announced every week!

You will receive an email every Friday morning featuring the latest chatter from the hottest topics, breaking news surrounding legislation, as well as exclusive deals only available to ARFCOM email subscribers.


By signing up you agree to our User Agreement. *Must have a registered ARFCOM account to win.
Top Top