Advertisement
Dennisaa

GetReordSet01

Oct 22nd, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2.     .synopsis
  3.     Get the content of a text file, e.g. http://norvig.com/big.txt - 6.5MB
  4.     From that content, copy to an array every record that has "t" at location 21 (offset 0)
  5.     Count the records in that array
  6. #>
  7. $fullContent = Get-Content -Path C:\temp\big.txt
  8. $fullContent.Count
  9. $filteredContent = @()
  10. $fullContent | foreach {
  11.         if ($_[21] -eq "t") {
  12.             $filteredContent += $_
  13.         }    
  14.      }
  15. $filteredContent
  16. $filteredContent.Count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement