You’ve been given a directory of log files, one for each day for the last twenty-four months, and you need to find the lines that contain the IP address 192.168.0.45 and place them in a single text file for further analysis.

One caveat: You have a Windows machine, you can’t install Perl, or maybe you don’t have time, or maybe you’re here because you’re like me and not a native Linux or Windows command line hacker but know how to Google the commands you need to just get your work done.

Yes, for most of us on this planet, that is ONE caveat.

Good news, there’s a Windows command for that:

You Googled your situation and found the answer on Stack Overflow and adapted it for your own needs. Whew! Stack Overflow to the rescue again!

And now you’ve become a whiz so your boss has asked you to go through more files. CSVs, text records, etc. Oh, and you will need to do this on a routine basis.

Crap.

Well, there’s a batch script for that (overly commented for ease of use/understanding, of course!):

Have fun!

About Chad Leigh Kluck

I enjoy technology development and management by following new trends, change and disruption, and security. I have a Master of Science in Software Engineering and my hobbies include railroads, history, do-it-yourself projects, writing, and ham radio (K0RRX). More...

I enjoy comments and feedback. Let me know if you have anything to share with me like stories, pictures, or other media. You can also contact me directly via the contact form. I'd love to hear from you!

Leave comments or feedback