Skip to content

Instantly share code, notes, and snippets.

@dallas-x
Created March 31, 2018 04:15
Show Gist options
  • Save dallas-x/c2137a2e8829efc460452cc9541d4482 to your computer and use it in GitHub Desktop.
Save dallas-x/c2137a2e8829efc460452cc9541d4482 to your computer and use it in GitHub Desktop.
working with powershell
$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