Working as a Windows server administrator many times I found myself in a situation where I have to check 50+ Mb log file for only one e-mail address or some other term. Ofcourse, many of you are going to think: “Yeah, like that’s a problem, just press CRTL+F and type in the term
” ,and you’re right. That way rocks when you have 10, or maximum 20 entries where that term is mentioned ( i.e some e-mail address) in the entire log file . But, what to do when you’re in a situation that a client wants to see the logs for his entire domain. All sent e-mail, all incoming e-mail, everything…then, it gets a little too much to do “crtl+f” and copy/paste the result in some other file which you are going to send to the client. Linux users have their way to do that, simply by : cat filename.txt | grep term > outputfile.txt . By starting to explore powershell, my first task was to find a similar command to do the same thing on a Windows server. Doing a little searching on the web I found the solution that is really simple and similar to linux command
hooray for me