I have 800+ html files that need to have a javascript added to them in the head. I can do the looping, setting filenames as variables, etc. but I cannot figure out how to insert my javascript file into the html.
My javascript is in a file named jsinsert.txt
It basically has this format: (snipped to save space)
The above code needs to be inserted just prior to </head>
I've tried various things but I am not very fluent with sed. Here's an example:
This fails. It actually puts the words jsinsert.txt just before the </head> rather than the contents of the jsinsert.txt file. Whatever, I've tried several things but cannot get the text to insert.
As I said previously. I can do the looping through the files, extract the filenames I am working with, etc. I just cannot properly insert the contents of the jsinsert.txt file just prior to the </head> tag. Any ideas about how I accomplish that?
I am iterating record by record through a file as below,
A,B
A,C
A,D
B,E
B,F
E,G
E,H
The same file should look like in the final output as below,
A,B
B,E
E,G
E,H
B,F
A,C
A,D (10 Replies)
Hi all,
I need to insert new text and change existing text in a file. For that I used the below line in the command line and got the expected output.
sed '$a\
hi...
' shell > shell1
But I face problem when using the same in script. It is throwing the error as,
sed: command garbled:... (4 Replies)
Hi ,
This is my first thread ; facing some issues withmy sed script
I need to insert the code from my log file which is between two keywords.
content is like this ........
log
############################
log1 log2
231 "Ban" "tom" and the line one of the cross line
friend... (2 Replies)
Hi All ,
Given a file , I need to delete , modify and insert lines matching certain patterns in that file using shell scripting.
e.g. If a file FILE1 has following content :
CUST.ABC.DEF = CUST.ABC.DEF * CUST.ABC.DEF
PRINTF(CUST.ABC.DEF)
CUST.ABC.DEF = mid(CUST.ABC.DEF,10.34)... (5 Replies)
Hi,
For the text file let us say t.txt having the statements as below.
filename : t.txt.
Contents :
This is first string1
This is first string2
This is first string3
The output of the file should have newline. How to introduce the new line so that the output be as follows
... (5 Replies)
Hello,
I have two text files (txt1 and txt2). txt1 contains many lines with a single number in each line. txt2 (xml format) contains information about the numbers given in txt1. I need to insert one line in txt2 within the scope of each number taken from txt1.
Sample problem:
txt1:
12
23... (1 Reply)
I have a huge file with record length around 5000 characters.
There is an ETL tool datastage which is writing this data to the file(AIX server). At position 4095 i have seen NULL Character(^@).
when i am using this command "head -1 file_nm | sed 's/\000//g'" --- the output is displaying... (3 Replies)
Hi There,
I am trying to load data from a csv file into a DB during our DB migration phase. I am successfully able export all data into a .csv file but those have to rewritten in terms insert statement which will allow for further population of same data in different DB
My exiting csv record... (6 Replies)
I have a script which is extracting data from a database in an excel file in below given format,
date_time calling_app1 count of requests
date calling_app x 34
date calling_app y 1034
I want to write a script which will write data into a file like this ... (3 Replies)
Discussion started by: TNT47
3 Replies
LEARN ABOUT REDHAT
javascript
javascript(n) HTML and Java Script Generation javascript(n)
NAME
javascript - Procedures to generate HTML and Java Script structures.
SYNOPSIS
package require Tcl 8
package require javascript ?1.0?
::javascript::makeSelectorWidget id leftLabel leftValueList rightLabel rightValueList rightNameList ?length? ?minWidth?
::javascript::makeSubmitButton name value
::javascript::makeProtectedSubmitButton name value msg
::javascript::makeMasterButton master value slavePattern boolean
::javascript::makeParentCheckbox parentName childName
::javascript::makeChildCheckbox parentName childName
DESCRIPTION
The ::javascript package provides commands that generate HTML and Java Script code. These commands typically return an HTML string as
their result. In particular, they do not output their result to stdout.
::javascript::makeSelectorWidget id leftLabel leftValueList rightLabel rightValueList rightNameList ?length? ?minWidth?
Construct HTML code to create a dual-multi-selection megawidget. This megawidget consists of two side-by-side multi-selection boxes
separated by a left arrow and a right arrow button. The right arrow button moves all items selected in the left box to the right
box. The left arrow button moves all items selected in the right box to the left box. The id argument is the suffix of all HTML
objects in this megawidget. The leftLabel argument is the text that appears above the left selection box. The leftValueList argu-
ment is the values of items in the left selection box. The leftNameList argument is the names to appear in the left selection box.
The rightLabel argument is the text that appears above the right selection box. The rightValueList argument is the values of items
in the right selection box. The rightNameList argument is the names to appear in the right selection box. The length argument
(optional) determines the number of elts to show before adding a vertical scrollbar; it defaults to 8. The minWidth argument
(optional) is the number of spaces to determine the minimum box width; it defaults to 32.
::javascript::makeSubmitButton name value
Create an HTML submit button that resets a hidden field for each registered multi-selection box. The name argument is the name of
the HTML button object to create. The value argument is the label of the HTML button object to create.
::javascript::makeProtectedSubmitButton name value msg
Create an HTML submit button that prompts the user with a continue/cancel shutdown warning before the form is submitted. The name
argument is the name of the HTML button object to create. The value argument is the label of the HTML button object to create. The
msg argument is the message to display when the button is pressed.
::javascript::makeMasterButton master value slavePattern boolean
Create an HTML button that sets it's slave checkboxs to the boolean value. The master argument is the name of the child's parent
html checkbox object. The value argument is the value of the master. The slaves argument is the name of child html checkbox object
to create. The boolean argument is the java script boolean value that will be given to all the slaves; it must be "true" or
"false".
::javascript::makeParentCheckbox parentName childName
Create an HTML checkbox and tie its value to that of it's child checkbox. If the parent is unchecked, the child is automatically
unchecked. The parentName argument is the name of parent html checkbox object to create. The childName argument is the name of the
parent's child html checkbox object.
::javascript::makeChildCheckbox parentName childName
Create an HTML checkbox and tie its value to that of it's parent checkbox. If the child is checked, the parent is automatically
checked. The parentName argument is the name of the child's parent html checkbox object. The childName argument is the name of
child html checkbox object to create.
SEE ALSO
html, ncgi
KEYWORDS
javascript, html, checkbox, submitbutton, selectionbox
javascript 1.0 javascript(n)