-
Automate lookup and fill
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
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks