I have a text file that I need to read in PowerShell.
The last character in each row is either a Y or a N.
I need to go through the file and output how many Y's and N's are in there.
Any ideas?
Assuming a file named "test.txt"... To get the number of lines ending in Y, you can do this:
get-content test.txt | select-string Y$ | measure-object -line
And to get the number of lines ending in N, you can do this:
get-content test.txt | select-string N$ | measure-object -line
Hope that helps.