Help - Search - Members - Calendar
Full Version: Bulk editing of HTML - HELP PLEASE
HTMLHelp Forums > Web Authoring > Markup (HTML, XHTML, XML)
Help please - I have a large number of HTML files that I would like to edit by using the file name as the heading for the page. Any tips on editing on bulk please? There are too many files to edit individually.
So if the file is called foo.html you want whatever title it has to be replaced with <title>foo</title>? Are all the files in the same folder?

I'm thinking. The text editor I use is programmable and this would be quite a simple task for me to do thanks to that. But I don't know of a standalone tool straight off that can do the same thing. Bulk edit, yes, but it must also be able to catch the file name. Maybe some Windows scripting (if you are on Windows). Not my forte though.
Christian J
A PHP script might be able to do it. There are functions for scanning files in a directory, reading their contents and doing string replacing (the latter this is the tricky part if a heading already exists).
Are you still around? I can help you. It would be a very simple AWK script with maybe 2 preliminary steps to perform. 1) Get a list of files to be processed. 2) A little bit of validation.

AWK is available on any version of 'NIX because it was written in UNIX and also on Windows using the GNU Win32 version of AWK.

Step 1 is obvious.; to get a list of files to operate on.
Step 2 is to validate that <title> and </title> are on the same line.

I may have not read the request corrrectly and assumed you wanted to change the <title> so step 2 may be to validate that <h1> and </h1> are on the same or line or <h2> or 3 or 4 or 5 or 6
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.