我試圖提取mpath名稱「DS4800_VG_STAGE *」和multipath -ll輸出的在線路徑的數量。蟒蛇多線組正則表達式
DS4800_VG_STAGE_2(3600a0b80004710ce00001ce24e08ce1c)DM-6 IBM,1815的FAStT
[大小= 241G] [特徵= 1個queue_if_no_path] [hwhandler = 1 RDAC] [RW]
\ _輪詢0 [PRIO = 100] [active]
\ _ 1:0:1:5 sdc 8:32 [active] [ready]
\ _ round-robin 0 [prio = 0] [enabled]
\ _ 2:0: 1:5 sdf 8:80 [active] [ghost]
DS4800_VG_STAGE_1(3600a0b80004706be00001ece4e08ca4f)dm-8 IBM,1815 FAStT
[size = 24112G] [features = 1 queue_if_no_p ATH] [hwhandler = 1個RDAC] [RW]
\ _輪詢0 [PRIO = 100] [活性]
\ _ 1:0:1:5 SDC 8:32 [活性] [準備]
\ _循環0 [PRIO = 0] [啓用]
\ _ 2:0:1:5 SDF 8:80 [活性] [鬼]
我已經成功地提取路徑名但我正在努力將其餘多線輸出收集到一個單獨的組中,以便我可以處理group2中有多少路徑在線。
^(\w+\s+).+?$$((?:[^\\\\]+\n+)+)
匹配1:
Group 1 = "DS4800_VG_STAGE_2"
Group 2 = "[size=241G][features=1 queue_if_no_path][hwhandler=1 rdac][rw]"
MATCH2:
Group 1 = "DS4800_VG_STAGE_1"
Group 2 = "[size=24112G][features=1 queue_if_no_path][hwhandler=1 rdac][rw]"
任何幫助將非常感激。
在此先感謝
你可以更具體地說明你想要解析哪些行嗎?我不熟悉這個命令。 –