I have a text file (Myfile.txt), line by line, which is very long and centered as shown below
...","ItemPrice":17000.0,"MustPay":17000.0,"PaywithCash":17000.0,"etc...
...","ItemPrice":900.0,"MustPay":900.0,"PaywithCash":900.0,"etc...
...","ItemPrice":1400.0,"MustPay":1400.0,"PaywithCash":1400.0,"etc...
so I want to get the number after the word "PayWithCash":, for example the first line is the number 17000 and so on to the next line, and save it to a new text file "result.txt"
1700
900
1400
I have tried several codes, including as below
echo off
SETLOCAL EnableDelayedExpansion
for /f "delims=" %%a in ('type Myfile.txt^|find "PayWithCash:"') do (
set "line=%%a"
set "line=!line:*PayWithCash =!
set /a "last=!line:~1!" 2>nul
)
echo %last% >> result.txt
And yes, I still can't get the desired result, can you help me?
I use google translate, I hope you understand