CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...: Biterscripting script that adds a copyright notice in every .html page.: Edit Log



JenniC
Novice

Apr 7, 2009, 9:53 AM


Views: 3183
Biterscripting script that adds a copyright notice in every .html page.

Hi arjunetal:

You said:


In Reply To


So exactly what I want is to add <p>How are you</p> before </body> tag.



This can be done very simply with biterscripting. (I had the same problem - wanted to insert copyright notices at the end of each page in tons of pages. Someone pointed me to biterscripting. It works great !) Here is a script. I will assume your html page is at C:/mysite/page.html.


Code
   


# Read in the page into a variable.

var str page ; cat "C:/mysite/page.html" > $page

# Insert "<p>How are you</p>\n" before "</body>".

sin -c "^</body>^l" "<p>How are you</p>\n" $page > $page

# Write page back.

echo $page > "C:/mysite/page.html"



You can also do this for all .html files in a folder (and subfolders). Use the following script.


Code
   

# Collect a list of .html files

var str list ; find -n "*" "C:/mysite" > $list

# Process one file at a time.

while ($list <> "")

do

# Get the next file.

var str file ; lex "1" $list > $file

# Call the above code

# Change cat "C:/mysite/page.html" > $page to cat $file > $page

# Also, change echo $page > "C:/mysite/page.html" to echo $page > { echo $file }

done



If you don't have biterscripting yet, download it free from http://www.biterscripting.com. Download and install all their sample scripts using the following command.


Code





Jenni

(This post was edited by JenniC on Apr 7, 2009, 9:54 AM)


Edit Log:
Post edited by JenniC (Novice) on Apr 7, 2009, 9:54 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives