# Related to File I/O function in Batch Script



## vjadhav (Sep 30, 2011)

Hello,

I want to filter a section from a log/txt file which starts from the 1st occurring of the word "error" in the file till end of file (EOF) in a variable. This i need in batch script.
As I want only the error/exception part from the whole log file to be displayed in the email-body section.

Thanks & Regards,
Vijay


----------



## Squashman (Apr 14, 2005)

I need to see what your input looks like.


----------



## JimFlagg (Aug 23, 2011)

I think something like this will work.



> @echo off
> set InputFilename="c:\your file path and name here"
> set OutputFilename="c:\your file path and name here"
> echo Error Log > %OutputFilename%
> ...



This works assuming the word error is in the first column. If not change the token accordingly.

Also note, this is not tested it is off the top of my head so you might have to tweek it a little to get it working.


----------

