...

View Full Version : Automate lookup and fill



hamboy
01-25-2006, 11:41 PM
Hi,



I'm wondering how I can make a script/something to automate fillin of a file by looking up another file for corresponding ID.



Text File to fill in (text1.txt)

------------------------------------------------------------------------------

EVENT initFailureNotification .1.3.6.1.4.1.8632.2.1.2.1.1 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*


EVENT ossencodeFailedDepNotification .1.3.6.1.4.1.8632.2.1.2.1.9 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*


EVENT socketconnectionLostNotification .1.3.6.1.4.1.8632.2.1.2.1.13 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*


EVENT primaryFileExistDepNotification .1.3.6.1.4.1.8632.2.1.2.1.23 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*


EVENT logfileCreateFailedDepNotification .1.3.6.1.4.1.8632.2.1.2.1.24 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*


EVENT chmRaidRedundCtrlrFailureNotification .1.3.6.1.4.1.8632.2.1.2.1.43 "Error Alarms" Normal
FORMAT NO FORMAT DEFINED;;$*





Excel file to look up and retrieve format (data.xls):

------------------------------------------------------------------------------

.1.3.6.1.4.1.8632.2.1.2.2.0 clear <<<$r;bloFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.1 clear <<<$r;;ccrFailureExNotification $8;;communicationsAlarm;;adapterError;;Major;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.2.6 clear <<<$r;;cgbFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.9 clear <<<$r;;cgbSupFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.2.10 clear <<<$r;;cguFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.13 clear <<<$r;;cguSupFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.2.14 clear <<<$r;;cqmSuccessExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.23 clear <<<$r;;cvtFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.24 clear <<<$r;;grsSuccessExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>
.1.3.6.1.4.1.8632.2.1.2.1.43 clear <<<$r;;moCardUnhealthyNotification $8;;communicationsAlarm;;adapterError;;Major;;$7;;$r_MSO:>>>





Resulting txt file (text1result.txt):

--------------------------------------------------------

Result:


EVENT initFailureNotification .1.3.6.1.4.1.8632.2.1.2.1.1 "Error Alarms" Normal
FORMAT <<<$r;;ccrFailureExNotification $8;;communicationsAlarm;;adapterError;;Major;;$7;;$r_MSO:>>>;;$*


EVENT ossencodeFailedDepNotification .1.3.6.1.4.1.8632.2.1.2.1.9 "Error Alarms" Normal
FORMAT <<<$r;;cgbSupFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>;;$*


EVENT socketconnectionLostNotification .1.3.6.1.4.1.8632.2.1.2.1.13 "Error Alarms" Normal
FORMAT <<<$r;;cguSupFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>;;$*


EVENT primaryFileExistDepNotification .1.3.6.1.4.1.8632.2.1.2.1.23 "Error Alarms" Normal
FORMAT <<<$r;;cvtFailureExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>;;$*


EVENT logfileCreateFailedDepNotification .1.3.6.1.4.1.8632.2.1.2.1.24 "Error Alarms" Normal
FORMAT <<<$r;;grsSuccessExNotification $8;;communicationsAlarm;;adapterError;;clear;;$7;;$r_MSO:>>>;;$*


EVENT chmRaidRedundCtrlrFailureNotification .1.3.6.1.4.1.8632.2.1.2.1.43 "Error Alarms" Normal
FORMAT <<<$r;;moCardUnhealthyNotification $8;;communicationsAlarm;;adapterError;;Major;;$7;;$r_MSO:>>>;;$*






I know in Excel, I can use something like VLOOKUP, but since text1.txt is a text file, when I paste it in excel, there is no format, so I can't even locate the ID (ie. .1.3.6.1.4.1.8632.2.1.2.1.43 ) to look up.



Can someone give me a hand on how to automate this in a script?


thanks in advance

Philip M
01-26-2006, 08:37 AM
I think you are in the wrong forum. JavaScript (which is not the same as Java) is a client-side langauge and cannot read from or write to a file.
Perhaps the mods will move this post to a more appropriate location.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum