Created
March 31, 2018 04:15
-
-
Save dallas-x/c2137a2e8829efc460452cc9541d4482 to your computer and use it in GitHub Desktop.
working with powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$collection = New-Object System.Collections.ArrayList | |
$GroupedIP = New-Object System.Collections.ArrayList | |
$counter | |
$start = 0 | |
$finish = 0 | |
Do { | |
if ($file[$counter].'Source IP' -eq $file[$counter+1].'Source IP'){ | |
$collection.Add($file[$counter]) | Out-Null | |
$finish++ | |
} | |
else{ | |
# $GroupedIP.Add($file[$counter-1].'Source IP') | |
write-host "$start --- $finish" | |
$GroupedIP.Add($collection[$start..$finish].'Source IP') | |
$start = $finish | |
} | |
$counter ++ | |
} | |
while($counter -le $file.Length) | |
foreach ($x in $GroupedIP){ | |
write-host $x | |
} | |
set-location $homeLocation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment