any script can be used to covert IP subnet?

say I have some netblocks, is it possible I can use a script to covert the subnet to every single ip?

for example, raw file has
"1.2.3.0 255.255.128.0"
"2.3.4.0 255.255.255.254"

and I want to run the script and print out every single IP in these netblocks.

or will it be easier if I change the raw file to netmasks format?
"1.2.0.0/17"
"2.3.4.0/31"