简体   繁体   中英

Windows batch string as delimiter for a string

I have a file containing multiple lines. I need only this line :

 Table: DSMAIN_FRANF.DEF02_002_REF_B - Deleted row(s) count: 44

In fact, I need only the number at the end of the line. The length of the line is variable, also the number, but the substring " Deleted row(s) count:" will always be there.

How can I get only what comes after "Deleted row(s) count:" in a line?

assuming, the syntax of the line is reliable ( ___:_____ Deleted row(s) count: xx )

for /f "tokens=3 delims=:" %%i in ('find "Deleted row(s) count:" t.txt') do set /a count=%%i
echo %count%

(also assuming, there is only one of those lines; if several, this will give you the last one)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM