Skip to content

Instantly share code, notes, and snippets.

@RichardSlater
Created March 4, 2022 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichardSlater/1774f17d73143ed798e7f030c3b22f80 to your computer and use it in GitHub Desktop.
Save RichardSlater/1774f17d73143ed798e7f030c3b22f80 to your computer and use it in GitHub Desktop.
Format CSV as IP Address List for qBittorrent (p2p)
Function Format-IP ($ip) {
$octets = $ip.Split(".") | Select-Object @{label="Octet";expression={ [Int32]::Parse($_).ToString("000") }}
return [String]::Join(".", $octets.Octet)
}
$ips = Import-Csv .\ru.csv | Select-Object -Property Start, End, Notes
$output = $ips | Select-Object @{label="Start";expression={ Format-IP $_.Start }}, @{label="End";expression={ Format-IP $_.End }}, notes
$output | ForEach-Object { "{0} - {1} , 000 , {2}" -f $_.Start, $_.End, $_.Notes }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment