2013-07-03 86 views
1

因此,我需要從Accurev流中提取最後一條促進消息,並將其放入Jenkins變量中以包含在Jenkins電子郵件中。我遇到的唯一問題是多行提升消息。我真的只是想推廣消息的第一線,但是這不是我用我的眼看/ F命令:在輸出的第一行停止FOR/F命令(Windows批處理)

FOR /F "tokens=1-25 delims=;" %i in ('accurev.exe hist -s <stream> -t now.1 ^|FIND "#"') DO @echo %i 

多線推進的消息,我得到這樣的輸出:

 
# This is a multiple line promote message 
# because my programmers need to include 
# accurate descriptions of the CRs that # they work on. 

那麼,收集第一行後,我的任何命令都會停止?

回答

3

與GNU的grep嘗試一下本作的Windows:

FOR /F "delims=;" %i in ('accurev.exe hist -s <stream> -t now.1 ^|grep -m1 "#"') DO @echo %i 
+0

太棒了!像冠軍一樣工作。謝謝! –

-2

FOR/F 「令牌= 1-25 delims =;」 %i in('accurev.exe hist -s -t now.1^| FIND「#」')DO @echo%i & & goto:eof

相關問題