Computing.Net > Forums > Programming > Batch Extract Text File & E-Mail

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch Extract Text File & E-Mail

Reply to Message Icon

Name: SchizophrenicX
Date: August 24, 2008 at 23:22:50 Pacific
OS: Windows XP Pro 2002
CPU/Ram: 3.0GHz/512
Product: Inter(R) Pentium(R)
Comment:

I have a log file generated after building and compiling. What I need to do now is to extract all the error out (kinda creating an error log) and send them out via Blat (of which I'm not very familiar too)

Aim: Extract all lines containing keyword "Error" and sent them out using Blat (command line e-mail client)

I thought of extracting those lines and append them to a file and send the contents of this new file and send it out but I have no idea how to search thru the text file with a keyword and extract the whole line. I fig prolly using a loop variable to keep count of the line number while using if-control that match the string. But I'm not very familiar with batch scripting yet so I'm posting this here for any help that is available while I'm working on this.

All help is appreciated thanks.

SchizophrenicX
"I'm not psychic; I'm just damn good"



Sponsored Link
Ads by Google

Response Number 1
Name: SchizophrenicX
Date: August 25, 2008 at 00:20:10 Pacific
Reply:

This is what I have for the extraction part.

log file name: m80dbg.log
output file name: errlog.log, errlist.log

findstr /r /c:"[^0] error(s)" m80dbg.log >errlist.log
findstr /r /c:"error" m80dbg.log >errlog.log

the problem is that the list of errors didn't came out as expected (errlist.log)
in cmd it has something like this

blahblah - a error(s), b warning(s)
blahblah - c error(s), d warning(s)

which is nice, but in the errlist.log most parts didn't come out nicely in new lines. Instead it looked something like this...

blahblah - a error(s), b warning(s)blahblah - c error(s), d warning(s)blahblah - e error(s), f warning(s)
blahblah - g error(s), h warning(s)blahblah

and so on... how do I redirect into the file with each nicely formatted into new line?

I'm looking into sending the mail now. Actually I wouldn't need the errlist.log as I will be sending the output of findstr /r /c:"[^0] error(s)" as the body message of the e-mail. I'm not sure. All help is appreciated thank you.

SchizophrenicX
"I'm not psychic; I'm just damn good"


0

Response Number 2
Name: SchizophrenicX
Date: August 25, 2008 at 02:28:48 Pacific
Reply:

no one yet? I've just confirmed that I'll need the errlist.log and so I need some help formatting it. Also I need to append another similar output into this file. Please help with the output. Thank you

Installing BLAT now.

SchizophrenicX
"I'm not psychic; I'm just damn good"


0

Response Number 3
Name: Mechanix2Go
Date: August 25, 2008 at 07:59:40 Pacific
Reply:

find /i "error" < my.log > error.log


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: SchizophrenicX
Date: August 25, 2008 at 19:29:47 Pacific
Reply:

Wow thanks a bunch Mechanix2Go, you really me out here. Anyway, with that out of the way, you think you could explain to me how come my part output in such a format and find/i gave the format i was looking for?

SchizophrenicX
"I'm not psychic; I'm just damn good"


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch Extract Text File & E-Mail

batch processing text files. www.computing.net/answers/programming/batch-processing-text-files/15280.html

Merging text files using batch file www.computing.net/answers/programming/merging-text-files-using-batch-file/19906.html

Batch Extract Text Lines One By One www.computing.net/answers/programming/batch-extract-text-lines-one-by-one/16093.html