This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Right now I have this little pipe going and it works,
$Result = $Var | Where-Object ... | Sort-Object ... | Group-Object ... | Select-Object ...
Currently I import an excel using import-excel and I set a column header to another var because it has a space in it and to get the where script block to work I had to do that.
What I'm wondering is this, can I create a hashtable /function block to set variables as needed and put multiple where queries for better readability? Most everything I found concerning hashtables involves loading an array into one or using a loop to process an array into a hashtable with filters but I'm dealing with a 20mb excel that I just want to filter and count grouped values. Am I one the right/wrong train of thought here?
ie $ColumnXY -Match 'This'
$ColumnJ -NotMatch 'That'
and so on.
More info:
$OSV="Column With Spaces"
`$Test3 = $Data | Where-Object -Property $OSV -Match 'Windows' ``
| Sort-Object -Property $OSV | Group-Object $OSV | Select-Object -Property Name,Count
Update: Thanks to u/Lee_Dailey that was exactly what I was hoping for.
Subreddit
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...