Batch – Find line in a text file and extract n following lines

Tags:
Find string extract lines
Hello, I have an application log file, and I need to extract from this log a few lines to send it by e-mail, I would like to do this from a batch file, I have done in the past some batch files to send e-mails with BLAT, and recently with PowerShell, for these commands I can specify a file [let's say for example ->] emailbody.txt to be the email body. I have an application log ApplicationLog.txt, with about 2000 lines. What I want to do, is to find a unique string in ApplicationLog.txt and extract the 6 following lines to a new file emailbody.txt . Thanks a lot for your help


Software/Hardware used:
Microsoft windows 2012
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen

    Not clearly understood your problem here. If understood correctly, you can find the special character/ unique string by using Find (Ctrl + F) and then can make another file by copy/ paste.

    But it seems that it is not easy that you have asked. It is better to provide more details.

    136,980 pointsBadges:
    report
  • ToddN2000
    can you provide more details. Where is the file located and what coding languages or scripts you are familiar with ? 

    131,595 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: