Summary: This is a summary of some of the additional resources for working with text and Windows PowerShell.
Good day. Microsoft Scripting Guy, Ed Wilson, is here. So, here's the deal. We are going along and decide to write a simple Windows PowerShell script. Before we know it, the thing has morphed into dozens of lines. And, also before we know it, we quickly find ourselves in the weeds. It begins like a day at the beach, perhaps like the one here.
And suddenly, before we know it, we are in the weeds, look around and, lo and behold, alligators. Dude!
And, all of a sudden, we are feeling as exposed as a bunny who accidentally hops into a nest of alligators.
This is the sixth post in a multi-part series of blog posts that deal with how to determine letter frequency in text files. To fully understand this post, you should read the entire series in order.
Here are the posts in the series:
- Letter frequency analysis of text by using PowerShell
- How to skip the beginning and ending of a file with PowerShell
- Read a text file and do frequency analysis by using PowerShell
- Compare the letter frequency of two text files by using PowerShell
- Calculate percentage character frequencies from a text file by using PowerShell
- Additional resources for text analysis by using PowerShell
A review of some of the topics that were covered this week
So, in writing a simple script to play around with the letter frequencies that occurs in a couple of text files, I ended up going over a lot of different concepts. Here is a list of the topics that were covered and a link to more information about those topics.
Reading text files: The Get-Content cmdlet
Join: the -Join operator
Converting the case of letters to all uppercase: The ToUpper() string method
Grouping objects: The Group-Object cmdlet
Sorting objects: The Sort-Object cmdlet
Arrays: Working with arrays
Adding items to arrays
Indexing into an array
Looping: the for statement
The GetEnumerator() method
Matching strings: The -match operator
Matching strings in a case sensitive fashion: The -cMatch operator
Making decisions: The if statement
Creating Functions: The function keyword
Adding parameters to a function
Calling a function
Working with string blocks: The Here-String
Counting stuff: The Measure-Object cmdlet
Selecting stuff: The Select-Object cmdlet
Creating custom properties with the Select-Object
Working with strings: General string operations
Working with the pipeline: Sending output from one cmdlet to another
I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at email@example.com, or post your questions on the Official Scripting Guys Forum. Also check out my Microsoft Operations Management Suite Blog. See you tomorrow. Until then, peace.
Microsoft Scripting Guy