homepage Welcome to WebmasterWorld Guest from 54.237.78.165
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

    
Find & Replace with different replacement text each time
I want the replacement text to be variable from a list
soccer_star

10+ Year Member



 
Msg#: 4253395 posted 5:39 pm on Jan 14, 2011 (gmt 0)

Hi

I have 1,000 html pages, the title of which is a name. The title tag of these pages is <title>name</title> ready for me to insert the correct name. Eg:

alice.html <title>name</title>
bob.html <title>name</title>
john.html <title>name</title>

I want to end up with:

alice.html <title>alice</title>
bob.html <title>bob</title>
john.html <title>john</title>

I have a text file with all the names listed in alphabetical order. So my text file reads:

alice
bob
john
(etc)

So I basically need a batch program to find 'name' in the first file (alice.html) and replace 'name' with the first name in my list (alice), then find the next instance of 'name' (in bob.html) and replace it with the second name in the list (bob) and so on. I have found a program to do that for file names, but not text within a file.

Can anybody help? I am using Dreamweaver CS5 for Mac if that helps, but could use a Windows program if necessary.

Thanks.

 

calder12



 
Msg#: 4253395 posted 5:10 pm on Apr 29, 2011 (gmt 0)

I've personally never heard of a program capable of doing that to be honest, it could be programmed but it would be a bit of a headache.

The reason I'm responding is basically I'm confused about this, to be honest it really seems like you're going to a lot of work to create a lot of pages that could be done in code with either asp or php.

Without knowing what you're trying to accomplish I can't be sure obviously but is there any reason your site couldn't be done dynamically rather than being hard coded html pages?

coopster

WebmasterWorld Administrator coopster us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4253395 posted 2:15 pm on May 2, 2011 (gmt 0)

I use Eclipse, an open source IDE, and it is capable of finding and replacing using regular expressions within a file, a folder, or an entire project. A project can be a group of folders linked to folders in the file system. I would like to believe DW would have a similar feature set. If not, you should be able to use the command line to find and replace values as well. Perl is a great command line tool for getting this task accomplished.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved