Scripting Wife Comments on Beginner Event 5


Summary: The Scripting Wife reveals her impressions of 2013 Scripting Games Beginner Event 5.

This event was tough—at least for me. You see, the thing is that I can read text files, and I can get listings of text files. And these log files are just text, after all. The trouble is the part about finding IP addresses. That had me stumped. I tried using the filter with Get-Content, but I could not make it work for me. So in the end, I had to ask the Scripting Guy for help.

Lots of luck there. But what he told me was just enough to get me moving in the right direction. He said I need to use a regular expression to find the IP address in the log files. He told me to search the Hey, Scripting Guy! Blog for regular expression and IP address. So I did.

I did not find exactly what I needed; but then again, I guess I did. What I was looking for was a Regex pattern that defines an IP address. I actually found the pattern in an old Scripting Guy blog post from 2007—written in VBScript script. It does not matter, because it is the pattern I needed. Once I had the pattern, I needed to find a cmdlet that would accept a pattern, so I used Get-Command like this:

Get-Command -ParameterName pattern

Then I needed to look up Help about the cmdlet I found, and figure out how to give it the Regex pattern. When I did that, I got my matches, and then I reduced the matches to unique ones. That did it. Hope this helps you. It is actually pretty cool, and it can be done as a one-liner.

Comments (12)

  1. Anonymous says:

    IP address reg. exp. pattern can be found at:

    http://www.regular-expressions.info/examples.html

    The IP addresses can be stored in a map (hash table) as a keys. Then $map.Keys returns the required result. Add Where-Object { $_ -like $AddrMask } to filter the addresses and you're done.

  2. northbetsportsbook says:

    I guess I have selected a mind blowing and interesting blog

  3. David says:

    In my view, if all webmasters and bloggers made good
    content as you did, the internet will be
    much more useful than ever before.
    http://haydaydiamonds.com

  4. might says:

    These could be created up excellent cafes and entertainment places or even Waterloo company structures, which might illustrate that your company is here to remain for the long run.
    http://officecleaningreviews.jigsy.com/

  5. E. Moring says:

    Now my job got easy with this unique login details for different sites. Initially I used to suffer a lot to memorize many login details! I can able to access other country sites without any trouble of losing memory. Even
    http://australianessays.com/ too made easier for me.

  6. jorg says:

    Thanks for sharing the post..parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. http://www.rebelmouse.com/worldsbestheadreview/

  7. why not try here says:

    This can be done by improving the web page for the search phrases their focus on clients generally use, which a process is known as seo, or SEO.
    http://capadociaturquiatravel.postbit.com/

  8. jorg says:

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. The Vales Anchorvale Crescent
    http://www.the-vales.com/australia-property-attractive

  9. jorg says:

    Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have. the vales ec sengkang
    http://www.the-vales.com/singhaiyi-group

  10. jorg says:

    The internet is bogged down with bogus blogs with no real message but the post was fantastic and well worth the read.
    https://www.rebelmouse.com/whatmensecretlywantreview/

  11. 4Life Transfer Factor Tri-Factor Formula says:

    I really enjoyed reading. I am truly inspired by this online journal!
    http://www.transferfactorhealth.com/collections/4life-transfer-factor-1/products/4life-transfer-factor-tri-factor-formula

Skip to main content