Script Shell how's converting .html files

Hello everybody, :slight_smile:

I need some help with a school project that I have to create for the next week. :eek:

So first, the aim of the Script is that I have a WebSite with a lot of .html / .shtml / .js / .css in one directory. That directory have few directory too but that's not so important, they have .css .js files too.

I'm explaining what the script need to do :

  1. Copy all inclusions from .shtml files to .html files

In each .html file, there is a comment line like this :

<!--#include virtual="SSI_include/DeclarationHTML_de.shtml" -->
or
<!--#include virtual="SSI_include/Header.shtml" -->
or
<!--#include virtual="SSI_include/DeclarationHTML.shtml" -->

When a file have a

#include

I need to copy (by exemple for the first one) the body of the DeclarationHTML_de.shtml in the .html. The body of the DeclarationHTML_de.shtml will replace the comment line !

  1. Delete all comments from .html / .css and .js files
    Comments for the .html are <!-- blablabla --> They start with <!-- and end with -->
    Comments for the .js and .css are like /* blabla / They start with / and finish with */

  2. Change all files .shtml to .html

  3. Create a new folder where I will put all files that I'v changed

  4. Verify if the website working (open a .html file in a Firefox page)

I never had before make some Shell script, what I know is that I need to make the workschool in Shell and use Sed (and others basic stuff). :confused:

I need some help for my work and some explainations ! :b:

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

Thread is closed now, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.

1 Like