Group-object powershell memory issue

Welcome Forums General PowerShell Q&A Group-object powershell memory issue

Viewing 0 reply threads
  • Author
    • #270743
      Topics: 3
      Replies: 8
      Points: 47
      Rank: Member

      Hi All,

      I have been using the following for sometime, however the logs I need to scan have grown immensely and it will no longer complete.  Powershell will use around 4GiB and  process endlessly.  Logs are roughly 3.6 GB in total, select-string would hit on 90% of the lines.  Ideas to optimize this would be greatly appreciated
      <br />$regex = "\DisplayName.*"<br />select-string -Path .\displayname.log -Pattern $regex -AllMatches | % { $_.Matches } | % { $_.Value } | Group-Object -Verbose -noelement | select name, count | sort-object count -Descending &gt; displayname.Counts.log<br />

      Linux works without any issues, and much quicker performance.  However this is not ideal for my automation.
      <br />perl -lne 'print $1 if /DisplayName(.*)/' displayname.log* | sort | uniq -c | sort -nr &gt;&gt; displayname.Counts.log<br />




Viewing 0 reply threads
  • You must be logged in to reply to this topic.