Wednesday, March 26, 2014

Neuron: Batch File + Excel FTW!

Excel is every network engineer's favorite way to organize lists of IPs for documentation, even though they wish they had a better solution.  Have you ever needed to add a large amount of IPs that happen to be in order?  There is a better way than typing them by hand.

So let's say you need to list out 10.10.10.1 - 10.10.10.240...

C:>for /l %i in (1 1 240) do echo 10.10.10.%i > outfile.txt


This produces a text file with an IP per line.  Copy and past that into an excel column and you're done.  If you need something more fun like say 10.10.10.0/30 - 10.10.10.252/30 you can change the first number in the parentheses to 0, the second number to 2 and the third to 252.  The syntax is that the first is the start for %i, the second is the amount to increment and the third is the stopping point.