Insert file contents into another file

General discussions about Advanced Find and Replace
Post Reply
amenzl
Posts: 4
Joined: Mon Dec 11, 2006 5:11 am
Location: Oregon

Insert file contents into another file

Post by amenzl » Mon Jan 05, 2009 10:32 pm

I have many html files (over 3500+) which need to be updated due to the fact my original data was corrupted and I did not notice this until after I had manually inserted the data on every file. This took me almost eight days to complete.

Now that I have the correct data located in new files (txt files) I'd like to be able to insert this without having to perform a manual edit for every file. This data I wish to update is one line for some records and over 25 lines for others and is in the middle of the file.

Is there a way in which I can tell AFR to insert the data from the correct file into the one that's bad?

Thank you,
Adrian


PS Since the correct data is currently in multiple txt files I can temporairly rename the html ones as txt if that is necessary

amenzl
Posts: 4
Joined: Mon Dec 11, 2006 5:11 am
Location: Oregon

Re: Insert file contents into another file

Post by amenzl » Thu Feb 26, 2009 11:28 pm

Well, I did have to edit the original files, but had the same issue when redesigning another site.

I was able to figure out how to merge the contents of one file into the other. I was working with html files and text files.

Here is what I did:
In the html files to update I found the common spot for the change and inserted REPLACETHISTXT using Advanced Find & Replace (about 600 files)

I then renamed all html files as txt files using a batch file (ren *.htm *.txt) and moved them into their own directory.

I created a batch file to merge the txt files and to save results into a new directory
(copy C:\DirA\1.txt+C:\DirB\1.txt C:\merged_files\1.txt)

I then used Advanced Find & Replace to move the merged data to the correct spot
Search for:
(.*)(REPLACETHISTXT)(.*)(</html>)(.*)
Replace with:
$1$5$3$4

Finally I renamed the txt files to html and voila!

anmldr
Posts: 19
Joined: Mon Jan 31, 2005 5:32 pm

Re: Insert file contents into another file

Post by anmldr » Fri Feb 27, 2009 5:20 pm

AFR truly is an amazing app that saves days of work. Just wish that it was available for the Mac.

Abacre
Site Admin
Posts: 1201
Joined: Mon Jan 31, 2005 5:32 pm
Contact:

Re: Insert file contents into another file

Post by Abacre » Fri Feb 27, 2009 7:31 pm

AFR will also be available in Mac. I think it will be at the end of this year or the beginning of the next year. But we are planning to release the Mac version of the software.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests