Search a specific string en make an output file.

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
walgro
Posts: 2
Joined: 01 Oct 2013 02:59

Search a specific string en make an output file.

#1 Post by walgro » 01 Oct 2013 03:01

Hi,

I want to search in a text file for a specific string "Translation is SUCCESFUL" and if it exist I want an output results.txt with a text "SUCCES". If it is not exist I want an output results.txt with a text "FAIL".
:P

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: Search a specific string en make an output file.

#2 Post by penpen » 01 Oct 2013 07:33

This may help:

Code: Select all

(findstr /C:"Translation is SUCCESFUL" Test.txt) >nul
if errorlevel 1 (
   (echo FAIL)>"results.txt"
) else if errorlevel 0 (
   (echo SUCCESS)>"results.txt"
) else (
   (echo FAIL)>"results.txt"
)
The textfile in this case is Text.txt, just replace it with what you need.

penpen

walgro
Posts: 2
Joined: 01 Oct 2013 02:59

Re: Search a specific string en make an output file.

#3 Post by walgro » 01 Oct 2013 07:55

Thanks, it works great :lol:

Post Reply