The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Bulk editing of HTML - HELP PLEASE
html-help
post Dec 5 2016, 04:36 PM
Post #1





Group: Members
Posts: 1
Joined: 5-December 16
Member No.: 24,954



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Dec 5 2016, 09:35 PM
Post #2


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,716
Joined: 9-August 06
Member No.: 6



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Dec 6 2016, 06:58 AM
Post #3


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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).
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
bobbb
post Dec 28 2016, 08:00 PM
Post #4





Group: Members
Posts: 5
Joined: 28-December 16
Member No.: 24,984



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 post has been edited by bobbb: Dec 28 2016, 08:09 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 29th March 2024 - 10:16 AM