我有一个纯文本文件,其中包含选项卡式信息,如下所示
ADVMONITOR "WINOSSPI-RPCService-Win2k"
DESCRIPTION "Checks the 'Remote Procedure Call (RPC)' Windows 2000 service and its corresponding process"
INTERVAL "5m2s"
SCRIPTTYPE "VBScript"
MULTISOURCE
INSTANCEMODE ONCE
MAXTHRESHOLD
SEPARATORS " "
ICASE
PROGRAM "Process"
DESCRIPTION "Returns the number of running 'svchost.exe' processes;"
MONPROG "opcntprocs.exe WINOSSPI-RPCService-Win2k-Process svchost"
PROGRAM "Service"
DESCRIPTION "Returns values that correspond to different states of the service 'RPC Service'"
MONPROG "opcntservice_chk.bat RpcSs WINOSSPI-RPCService-Win2k-Service"
MSGCONDITIONS
INSTANCERULE "Combined Service and Process Monitor; suppress messages caused by same case;"
ID "d5ca6823-37d4-4581-886a-2aad3462d9e0"
DESCRIPTION "Checks the services and processes"
CONDITION_ID "0cdb88dd-0338-47d3-a5f5-e4d982e8a1a9"
CONDITION
我需要的是从每个不同的块中获取信息,以便我可以将这些信息导入数据库,但是我无法通过不同的块进行很好的迭代,以从每个块中获取正确且可识别的数据方式。
我尝试使用名为 的类根据选项卡识别块tabbedLinesTree
,这会将所有选项卡式文本转换为 XML,这也很有用,但是不同的字段没有显示为字段名称或任何其他方式来识别我们要去哪个块通过。
恢复...我想通过该文件并为每个块获取(作为示例)一个具有名称PROGRAM
的数组,以及该块的...PROGRAM
DESCRIPTION
MONPROG
不知道如何概念化这个,你能帮我解决这个问题吗?
我擅长 PHP,但如果需要,我可以实现任何其他解决方案。
Ps:有些区块可以有更多的选项卡或者更多的字段(行)信息。
--- 在 NIGEL 的回答之后添加了以下文字 ---
第二个文本示例...
SYNTAX_VERSION 5
LOGFILE "OvSvcDiscErrorLog"
DESCRIPTION "Self-Management OvService Discovery agent error log"
LOGPATH "<OvSvcDiscErrorLog>"
INTERVAL "5m"
CHSET ASCII
FROM_LAST_POS
NO_LOGFILE_MSG
CLOSE_AFTER_READ
SEPARATORS " "
MSGCONDITIONS
DESCRIPTION "[E01-001] EXCEPTION while installing policy"
SUPP_DUPL_IDENT "3m"
COUNTER_THRESHOLD 0
CONDITION_ID "17adc1d1-32cf-42ca-be5f-1cf784f19026"
CONDITION
TEXT "<*> \\[E01-001\\] EXCEPTION while installing policy <*.polname>" SEPARATORS " "
SET
SEVERITY Critical
APPLICATION "OVO/Win"
MSGGRP "OVO"
OBJECT "OvSvcDiscAgent"
TEXT "[E01-001]EXCEPTION while installing policy "`