homepage Welcome to WebmasterWorld Guest from 54.167.173.217
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / WYSIWYG and Text Code Editors
Forum Library, Charter, Moderator: open

WYSIWYG and Text Code Editors Forum

This 66 message thread spans 3 pages: < < 66 ( 1 [2] 3 > >     
How to edit a bunch of static HTML files at once?
Perfection

10+ Year Member



 
Msg#: 3769316 posted 1:21 am on Oct 20, 2008 (gmt 0)

I have an older site that is just about 100 static html pages. Instead of hand editing 100 files, what I'd like to do is make the same edits to all of them, all at once.

I use Notepad++, which kind of does this with the "Find" and "Replace All" functions, but this only works with a small number of characters. I want to basically replace a block of code with another block of code... or just add a block of code to a specific spot without replacing anything.

Does anyone know if there is any way to do this or any program that will give me this capability?

Thanks in advance for any help.

 

jhood

10+ Year Member



 
Msg#: 3769316 posted 6:17 pm on Mar 21, 2009 (gmt 0)

Homesite, which comes bundled with DreamWeaver but can also be purchased separately, has a great sitewide search-replace function that's easy to use for non-coders.

In Linux, there is KFileReplace, also easy to use.

getcooking

5+ Year Member



 
Msg#: 3769316 posted 7:10 pm on Mar 21, 2009 (gmt 0)

Wow - I thought I was the only one who still used homesite (vers 4.5)! Anyone try installing an ancient version on a Vista machine? Or even their most recent version of 5.5? I need a new pc but am afraid I won't be able to run homesite anymore (which gets used many, many, many hours a day every single day of the week here!). So yes, a vote for Homesite from me too lol!

On my mac, however, I use BBedit. Haven't quite got the hang of it yet, but it seems good.

ColinG

5+ Year Member



 
Msg#: 3769316 posted 8:19 pm on Mar 21, 2009 (gmt 0)

I would approach this somewhat differently.

I would use one of the tools above and create a library function in Dreamweaver so you can update all the code again at a later date. One you have the library include code cut and pasted, you can use Dreamweaver to expand the code and later update it.

creative craig

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 10:01 pm on Mar 21, 2009 (gmt 0)

I use Editpad - never had any issues with global find and replace on static sites, one with 300+ pages.

httpwebwitch

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



 
Msg#: 3769316 posted 10:42 pm on Mar 21, 2009 (gmt 0)

Allaire HomeSite had a very powerful S&R feature, letting you do multiline replacements with Regular Expressions. It also let you preview the "find" before committing to the "replace". I have not found another tool that does a better job.

Visual Studio has a good "find in files" and "replace in files", though I find its interface a little annoying.

Notepad++ is excellent, I love it, but watch out because it's a bit unstable and may crash half way through a S&R. If it does, it could leave your files all fubar.

OF COURSE
no one should ever be doing massive S&R functions on many many files! Use SSI - (Server Side Inclusion) instead! Keep your code modular! use require() and include() for anything that's going to be used more than once, and functions for everything else.

Lynque

5+ Year Member



 
Msg#: 3769316 posted 11:00 pm on Mar 21, 2009 (gmt 0)

Visual Studio has a pretty nice search and replace tool in which you can even set it to only apply the switch to files of a certain extension. i.e. .asp as opposed to .aspx

I find between it and dreamweaver I can accomplish all of the search and replace tasks with little to no trouble.

MatthewHSE

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 11:42 pm on Mar 21, 2009 (gmt 0)

BBedit (Mac) has wild card features, allowing you to search and replace text even if it has some different characters, you can use # for numbers, you can use * and such.

Have you tried the regex find/replace features in EditPad? That can do what you're talking about. It also integrates with RegexBuddy, which is very handy for those of us who can't compose regular expressions right off the top of our heads! ;)

beavis

10+ Year Member



 
Msg#: 3769316 posted 11:59 pm on Mar 21, 2009 (gmt 0)

Advanced Find and Replace from Abacre

stef25

10+ Year Member



 
Msg#: 3769316 posted 7:59 am on Mar 22, 2009 (gmt 0)

find & replace is the only reason i keep dreamweaver installed on my mac. notepadd++ also works well for me on windows machines

4dwebhosting

5+ Year Member



 
Msg#: 3769316 posted 12:05 pm on Mar 22, 2009 (gmt 0)

It's for stuff like this that I still keep a copy of Homesite installed (first it was Allaire Homesite, then Macromedia Homesite, then Adobe bough Macromedia, and it vanished). Outdated, deprecated, bought out by progressively fatter software companies until it got relegated into not-quite-abandonware (ie: you can't buy it, but lord help you if you in any way violate the copyright). So don't go searching in the darker parts of the net for it, because that would be wrong >:-}
And still, hands down, the best HTML code editing software ever.

Mass search and replace:
All open files (organized in tabs, years before tabs were cool).
All files in a directory.
All files in a group of directories.

For old "code junkies" who never cottoned on to WYSIWIG design tools that generate their own (bloated) code, it still reigns supreme. (IMHO)

OMG! I've meet someone else that thinks this too. I've used HomeSite right from the start (when it was Allaire HomeSite) which is about 7 years now. I've tried to move away the but the search and replace has always dragged me back. Amazing feature.

Dominic_X

10+ Year Member



 
Msg#: 3769316 posted 12:44 pm on Mar 22, 2009 (gmt 0)

I would approach this somewhat differently.

I would use one of the tools above and create a library function in Dreamweaver so you can update all the code again at a later date. One you have the library include code cut and pasted, you can use Dreamweaver to expand the code and later update it.

^^^^^^ This is the best practice.

Any sections of a page that are the same like a footer or a menu should be kept as library items. It saves a lot of time.

Romac34

5+ Year Member



 
Msg#: 3769316 posted 3:53 pm on Mar 22, 2009 (gmt 0)

I use "Alias Find and Replace". It rocks.

[edited by: caine at 10:33 pm (utc) on Mar. 22, 2009]
[edit reason] no url drops [/edit]

werty

WebmasterWorld Administrator 10+ Year Member



 
Msg#: 3769316 posted 7:46 pm on Mar 22, 2009 (gmt 0)

On 100 page static site I would make all common elements(header, footer, navigation) SSI (server side includes) and then just edit those includes to change what I wanted on the site.

But in order to do it on an existing site I would use Dreamweavers find and replace and for all files in the site, after I made a backup of course (c;

dreamcatcher

WebmasterWorld Senior Member dreamcatcher us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3769316 posted 9:01 am on Mar 23, 2009 (gmt 0)

Just a heads up for newbies. BK ReplaceEm is now called 'Replace Text'.

dc

2clean

5+ Year Member



 
Msg#: 3769316 posted 9:25 am on Mar 23, 2009 (gmt 0)

Homesite is to web software what Renewable energy is to industry. Unused and forgotten in favour of things that pollute.

:)

himalayaswater

5+ Year Member



 
Msg#: 3769316 posted 1:21 pm on Mar 23, 2009 (gmt 0)

cat 'file' sed "s/from/to/g" > newfile

sed -i "s/from/to/g" filename

gilzero

5+ Year Member



 
Msg#: 3769316 posted 3:05 pm on Mar 23, 2009 (gmt 0)

Have you tried "Actual Search & Replace", I have been using it all the time. Very productive.

kapow

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 5:57 pm on Mar 23, 2009 (gmt 0)

I use DreamWeaver for sitewide search and repace. I also use php-include for common elements such as header, footer, menu...

DreamWeaver is supposed to have a regex facility in its search and repace, but I didn't get the result I wanted (I should also say, I'm not very familiar with regex).

The ultimate search and replace IMO would be:
FIND all code that:
1.) starts with [insert your code here],
2.) has anything in the middle,
3.) ends with [insert your code here],

REPLACE with [insert your code here].

Has anyone been able to make DW do this?

ogletree

WebmasterWorld Senior Member ogletree us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3769316 posted 6:26 pm on Mar 23, 2009 (gmt 0)

Draemweaver is real good at this.

old_expat

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 6:20 am on Mar 24, 2009 (gmt 0)

I use a program called "Alert Wildcard" .. they have a free trial version. It will do multiple lines, wildcard replace, and it's VERY fast .. but it's also like handling dynamite .. backup, backup, backup.

If you think your way carefully through the process before you start, it can do some really neat stuff.

saxman

5+ Year Member



 
Msg#: 3769316 posted 2:00 pm on Mar 24, 2009 (gmt 0)

Just use .asp files and make multiple includes for each section that you plan on having to edit over teh life of your website. Information areas that includes "Address" or "Phone numbers" that appear on all pages... just make an include adn then on;y edit the include and the changes will appear across the entire website.

L8 - Saxman

old_expat

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 4:06 am on Mar 25, 2009 (gmt 0)

>> Just use .asp files and make multiple includes for each section that you plan on having to edit over teh life of your website.

You don't have to use .asp. Server Side Includes (SSI) will do the same thing on HTML or (PHP includes) PHP pages.

kingleedy

5+ Year Member



 
Msg#: 3769316 posted 8:11 am on Mar 25, 2009 (gmt 0)

UE,DW,EMEDITOR

getxb

5+ Year Member



 
Msg#: 3769316 posted 11:42 am on Mar 25, 2009 (gmt 0)

EditPlus is my choice.

teenwolf

10+ Year Member



 
Msg#: 3769316 posted 6:13 pm on Mar 26, 2009 (gmt 0)

EditPad is the way to go. A distant 2nd place goes to HomeSite.

Balle

10+ Year Member



 
Msg#: 3769316 posted 10:27 am on Mar 27, 2009 (gmt 0)

HomeSite

Seb7

5+ Year Member



 
Msg#: 3769316 posted 10:42 am on Mar 27, 2009 (gmt 0)

ok. I must be the only person to use a vbs script to make massive complex changes to client sites.

luckystrike

10+ Year Member



 
Msg#: 3769316 posted 11:37 pm on Apr 1, 2009 (gmt 0)

guys/girls while we are on the subject do you know if any of these programmes will allow you to change:

the file extension for multiple files - suppose i have multiple .html pages and want to change this to to htm...etc (just an example)

that will allow you to change the file names of multiple files - say you have twenty word documents and you want to change the title for each to include the current date

grelmar

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 7:55 pm on Apr 2, 2009 (gmt 0)

Command line bash. Go to a directory full of files you want to change the extensions of, type in:

for i in *.html; do mv "$i" "${i/.html}".htm; done

not sure how to do that in Win/DOS, but that should work on a *nix box.

old_expat

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3769316 posted 7:32 am on Apr 3, 2009 (gmt 0)

guys/girls while we are on the subject do you know if any of these programmes will allow you to change:

the file extension for multiple files - suppose i have multiple .html pages and want to change this to to htm...etc (just an example)

that will allow you to change the file names of multiple files - say you have twenty word documents and you want to change the title for each to include the current date

"Renamer" .. freeware. It can make all sorts of changes .. all the files in a folder. Will change extensions, '-', '_', words, case sensitive .. lots of choices. Append and prepend, all instances, first intance, etc.

Has a preview feature that lets you avoid mistakes.

CrustyAdmin

5+ Year Member



 
Msg#: 3769316 posted 2:36 am on Apr 4, 2009 (gmt 0)

I've used this for quick and dirty editing. You need access to perl on your host.

find /directory_of_website/ -type f ¦ xargs perl -pi -e 's/old_value/new_value/g'

This will work on any file in the directory

This 66 message thread spans 3 pages: < < 66 ( 1 [2] 3 > >
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