我需要解析一个包含服务信息和表的文件。应仅从表中检索主要值。
请告知我们如何才能从" =========="开始解析?或者我可以在桌子前跳过服务信息?问题是服务信息可能多达50多行,并且无法为每个行编写模式。
180401-14:50:33 18.XXX.XX.XX 19.0n stopfile=/tmp/156
Checking MOM version...RBS_NSHELFE_MODEL_UK_434_51
Parsing MOM (cached): /var/opt/ericsson/amos/moshell_logfiles/fitofs/logs_moshell/tempfiles/20180405-145440_75/RBS_NODE_MODEL_U_4_591.xml.cache.gz ....................................................................Done.
Using paramfile /opt/amos/moshell/commonjars/pm/PARAM_RBS_908.txt
Parsing file /opt/amos/moshell/commonjars/pm/PARAM_RBS_908.txt ..............................................................................................Done.
Fetching IOR file...Done.
Connecting to 10.XXX.2XX.XX:45678 (CorbaSecurity=ON, java=1.7.0_51, DFACOM=R89IKW, DFACOB=R45RT)
**** Welcome to the Simple Mo Browser (version 3.0)!
Trying file=/var/optamos/moshell_logfiles/tempfiles/20180305-145990_75/YU66
**** Test Construction OK
****
$mobrowser_pid = 908
Connected to 17.XXX.XXX.XX (SubNetwork=ONRM_WE_OKL_O,SubNetwork=WSX987,ManagedElement=100)
Last KO: 1209. Loaded 1209 KOs. Total: 1221KOs.
Checking available shelfs...
Collecting SPEED wifi data...
.......
Collecting CPU shelf data...
Created following board-groups: all, wer, ik, pl, sd, boardf, wsyu8, vse, fcv, hnj, sccpmp, et, etmfg, etmfx, qw34df, dfr, qw56df, aal8uj, xp, trx, rx, tem, su[1-8].
Type "bp" to view available board-groups and "bp <group>" to view group contents.
Collecting tpm data...
..........
Collecting UF data...
put /var/opt/amos/moshell_logfiles/tempfiles/20180305-148840_75/R/d/usr/TY6HGNB88AZe345O ... OK
..............................................................................................................................................
PART: IB10203T DOM_OO_BACKPLANE CTU09098787/8_QW90TY6 U17I2.P ()
=====================================================
TPM LED BOARD LOCATION U ACTION STATE CIRCLE CREACJ R/p Y PRODUCTNUMBER ROI SERIAL DATE KO
=====================================================
0 1 KKK4101 Main_TOP 2 ON OFF OFF ON 0% 18% TRY105557/4 R44/A TURT5683 20160228 1,Slot=5 (1100/1100 BJ)
=====================================================
答案 0 :(得分:0)
可以使用非贪婪的词法分析器规则:
SERVICE_INFO : .*? '==========' -> skip;
答案 1 :(得分:0)
实现这一目标的一种方法是使用名为islands grammars的antlr功能。简而言之:要使用它们,您必须实际上识别开始标记和停止标记,以便您可以切换词法模式。