Output to a separate file all lines containing a string *ERROR

I want to pull out all lines in a txt file that contain *WARNING and otput to a separate txt file. Want to use Batch. Please help
LuckyLucksAsked:
Who is Participating?
 
oBdAConnect With a Mentor Commented:
A simple "find" will do the trick:
type "SomeFile.txt" | find /i "*WARNING" >"SeparateFile.txt"

Open in new window

If you want to add to the separate file instead of overwriting it, use double ">":
type "SomeFile.txt" | find /i "*WARNING" >>"SeparateFile.txt"

Open in new window

0
 
LuckyLucksAuthor Commented:
type is not a command , you are just describing what needs to be typed, right?
0
 
Bill PrewConnect With a Mentor Commented:
TYPE actually is a command, it reads a file and displays it to standard output.

You can actually do the same thing slightly simpler as:

find /i "*WARNING" <"SomeFile.txt" >"SeparateFile.txt"

~bp
0
 
oBdACommented:
"type" is a regular command; I use it to avoid the separator line(s) that appears when using find "something" file.exe I find it easier to read than redirecting the output like billprew suggested.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.