
[已解決]批處理怎樣從文本中提取字符串最后由 xudaweb 于 -9-26 18:24描述下遇到的問題:在測試記錄的txt中,有如下固定格式的文本(其中test-A,test-B,test-C,test-D都有很多個)
- test-A, 0 volts.
- Measured: 0.0001293 low limit: -0.2 high limit: 0.2
- test-A, 0 volts.
- Measured: 0.0001294 low limit: -0.2 high limit: 0.2
-
- test-B, 200 na.
- Measured: 0.000002 low limit: 1 high limit: 2
- test-B, 200 na.
- Measured: -0.000001999 low limit: -2 high limit: -1
- test-C
- Measured: 1.995 expected: 1.995
- test-D
- Measured: -17.011 expected: -17.011
nclick="copycode($('code0'));">復制代碼
現在需要把所有test-A,test-B的項目下測量值全部提取出來,希望得到的結果如下:
- 0.0001293
- 0.0001294
- rem 此處略去很多...
- 0.000002000
- -0.000001999
- rem 此處略去很多...
nclick="copycode($('code1'));">復制代碼
經自己摸索,現在僅能把所有包含Measured的行,提取出來后,再提取出后面測量的數值。但是test-C,test-D不需要的也提取進來了!感覺這樣的邏輯有問題,請各位給個思路。