Welcome to WebmasterWorld Guest from 54.196.244.45

Forum Moderators: open

Message Too Old, No Replies

How to edit a bunch of static HTML files at once?

     
1:21 am on Oct 20, 2008 (gmt 0)

Full Member

10+ Year Member

joined:June 27, 2001
posts:234
votes: 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.

6:17 pm on Mar 21, 2009 (gmt 0)

Preferred Member

10+ Year Member

joined:Aug 15, 2003
posts:421
votes: 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.

7:10 pm on Mar 21, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:June 4, 2008
posts:195
votes: 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.

8:19 pm on Mar 21, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Dec 16, 2007
posts:48
votes: 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.

10:01 pm on Mar 21, 2009 (gmt 0)

Senior Member from ZA 

WebmasterWorld Senior Member 10+ Year Member

joined:July 15, 2002
posts:1720
votes: 1


I use Editpad - never had any issues with global find and replace on static sites, one with 300+ pages.
10:42 pm on Mar 21, 2009 (gmt 0)

Moderator from CA 

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

joined:Aug 29, 2003
posts:4059
votes: 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.

11:00 pm on Mar 21, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Feb 22, 2005
posts:70
votes: 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.

11:42 pm on Mar 21, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 9, 2003
posts:1908
votes: 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! ;)
11:59 pm on Mar 21, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 24, 2003
posts:119
votes: 0


Advanced Find and Replace from Abacre
7:59 am on Mar 22, 2009 (gmt 0)

Preferred Member

10+ Year Member

joined:May 4, 2004
posts:394
votes: 0


find & replace is the only reason i keep dreamweaver installed on my mac. notepadd++ also works well for me on windows machines
12:05 pm on Mar 22, 2009 (gmt 0)

New User

10+ Year Member

joined:July 23, 2005
posts: 13
votes: 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.

12:44 pm on Mar 22, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 28, 2004
posts:85
votes: 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.

3:53 pm on Mar 22, 2009 (gmt 0)

New User

5+ Year Member

joined:Oct 4, 2007
posts:39
votes: 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]

7:46 pm on Mar 22, 2009 (gmt 0)

Moderator from US 

WebmasterWorld Administrator 10+ Year Member

joined:Dec 3, 2002
posts:1904
votes: 4


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;

9:01 am on Mar 23, 2009 (gmt 0)

Senior Member

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

joined:Mar 30, 2003
posts:3719
votes: 0


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

dc

9:25 am on Mar 23, 2009 (gmt 0)

Full Member

5+ Year Member

joined:Dec 2, 2008
posts:222
votes: 0


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

:)

1:21 pm on Mar 23, 2009 (gmt 0)

Full Member

5+ Year Member

joined:Jan 29, 2008
posts:243
votes: 0


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

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

3:05 pm on Mar 23, 2009 (gmt 0)

New User

5+ Year Member

joined:July 15, 2007
posts:39
votes: 0


Have you tried "Actual Search & Replace", I have been using it all the time. Very productive.
5:57 pm on Mar 23, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2001
posts:1281
votes: 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?

6:26 pm on Mar 23, 2009 (gmt 0)

Senior Member from US 

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

joined:Apr 14, 2003
posts:4249
votes: 16


Draemweaver is real good at this.
6:20 am on Mar 24, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 26, 2003
posts:705
votes: 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.

2:00 pm on Mar 24, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:May 6, 2008
posts:47
votes: 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

4:06 am on Mar 25, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 26, 2003
posts:705
votes: 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.

8:11 am on Mar 25, 2009 (gmt 0)

New User

5+ Year Member

joined:Mar 25, 2009
posts:7
votes: 0


UE,DW,EMEDITOR
11:42 am on Mar 25, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 17, 2005
posts:169
votes: 0


EditPlus is my choice.
6:13 pm on Mar 26, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 23, 2004
posts:127
votes: 0


EditPad is the way to go. A distant 2nd place goes to HomeSite.
10:27 am on Mar 27, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 4, 2003
posts:124
votes: 0


HomeSite
10:42 am on Mar 27, 2009 (gmt 0)

Preferred Member

5+ Year Member

joined:Nov 20, 2007
posts:585
votes: 0


ok. I must be the only person to use a vbs script to make massive complex changes to client sites.
11:37 pm on Apr 1, 2009 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 17, 2003
posts:106
votes: 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

7:55 pm on Apr 2, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 4, 2004
posts:683
votes: 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.

7:32 am on Apr 3, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 26, 2003
posts:705
votes: 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.

This 66 message thread spans 3 pages: 66