Code - Functional programming (FP) - Collection Operations in Powershell
The current object is represented by the _ symbol.
Get-ItemProperty HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* |
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate |
Format-Table –AutoSize
gc log.txt | %{ $_ -replace '\d+', '($0)' } # sed
gc log.txt | %{ ($_ -split '\s+')[3] } # Get the 4th element separated by space
Get-Children . | ForEach-Object {
Write-Host $_
}
Get-OdbcDriver |
Select Name, Platform, Attribute |
Where-Object {$_.Name -like '*SQL Server*' -and ($_.Platform -eq '64-bit')}
gc log.txt | select -first 10 # head
gc log.txt | select -last 10 # tail
gc log.txt | more # or less if you have it installed
@(Get-Alias).Count
$m = get-alias | measure
$m.Count
$a | sort -unique
select -uniq ?