function fnValidateId(){
var array_id = new Array("444","7888","6633","555","146562","3333","33332")
var tmp_id = document.form1.id.value;
var num=0;
while(1)
{
if(tmp_id == array_id[num])
{
return true;
}
else if(num == 7)
Now i want to (some way through shell script or awk) just pass the id to script and the modify the file to add the id to the array and increment the num by 1.
It's a bit complex, probably not the way to go but it works perfectly. Remember that this code does not check if you're precisely changing fnValidateId(). It just searchers for text and changes it (could be within any function). Search "ajax" for other ways to do this without having to change the script itself.
What operating system are you using? If it's Solaris (and possibly others) you may need to use /usr/bin/nawk or /usr/xpg4/bin/awk instead of the default /usr/bin/awk, because it is prehistoric.
mine is AIX
There is no issue in using awk.
Even the first statement works,
awk '/new Array/{gsub(/\)/,",\"'$1'\")")};{print}' file.html
the next statement is throwing error.