I have a load of logs being generated each time an app runs, I want the very last line of each to be collated into a file or printed on screen by a batch file. e.g I have a dir with files like log123.log,log124.log,log125.log
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That can indeed be done with a Windows batch file, using a
forloop to count the lines:If your files do not end with a newline character, you’ll have to initialize the
line_countvariable to0instead of-1.You can redirect
more‘s output to append the results to a file: