سؤال

I need to create batch file what finds string in the code and insert them into new file.

For example, I have a file:

...

<aaaa> AAA </aaaa>

<bbbb> BBB </bbbbb>

<RESULT="RIV/123456789:123456/12:1234567" XXXX="xxx" YYYY="yyy" ZZZZ="zzz">

<cccc> CCC </cccc>

<dddd> DDD </dddd>

...

and in the separate file (for example results.txt) I need to export only the Results:

...
RIV/123456789:123456/12:1234567
RIV/123456789:123456/12:1234567
RIV/123456789:123456/12:1234567
...

I tried to figure out many times but with no luck :-( , I would appreciate your help!

Thank you in advance, James

هل كانت مفيدة؟

المحلول

you might try this:

@ECHO OFF &SETLOCAL
(FOR /f tokens^=2delims^=^"  %%a IN ('findstr /l "RIV/" file') DO (
    ECHO(%%a
))>newfile
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top