mardi 3 juillet 2018

powershell to increment variable and add to new file

I have a file that looks like this.

Network          Comment
10.2.20.0/23     Internal Network
10.4.0.0/21      Test Network
10.12.152.0/22   External Network
10.34.16.0/24    Training Network
10.34.24.0/23    Sysadmin Network

I need to extract all subnets under 'Network', convert to /24 subnets and export them to a new file with comments.

So the new file should look like.

Network          Comment
10.2.20.0/24     Internal Network
10.2.21.0/24     Internal Network
10.4.0.0/24      Test Network
10.4.1.0/24      Test Network
10.4.2.0/24      Test Network
10.4.3.0/24      Test Network
10.4.4.0/24      Test Network
10.4.5.0/24      Test Network
10.4.6.0/24      Test Network
10.4.7.0/24      Test Network
10.12.152.0/24   External Network
10.12.153.0/24   External Network
10.12.154.0/24   External Network
10.12.155.0/24   External Network
10.34.0.0/24     Training Network
10.34.24.0/24    Sysadmin Network
10.34.25.0/24    Sysadmin Network

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire