Generator script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Generator script
# 1  
Old 02-28-2016
Generator script

Hello again unix.com people,

I need your help again. I'm currently need a script that will generate ip ranges... lets say from 64.1.1.1 to 74.255.255.255 and the output should be like this:

Code:
64.1.1.2
64.1.1.3
.............
.............
74.255.255.254
74.255.255.255

(line-by-line)

Thank you again.

Galford D. Weller

Last edited by galford; 02-28-2016 at 06:10 AM..
# 2  
Old 02-28-2016
Hello Galford

Any attempts from your side yet?
Where and why are you stuck?

Thank you
# 3  
Old 02-28-2016
Did you search these fora as recommended? How about this one?
# 4  
Old 02-28-2016
Hello sir,

I'm really a newbie and I'm stuck at a blank page (lol).

---------- Post updated at 05:20 AM ---------- Previous update was at 05:14 AM ----------

Quote:
Originally Posted by RudiC
Did you search these fora as recommended? How about this one?
Looks nice but I dont know how to use it.

Code:
while IFS=", " read IP1 IP2
  do    BIP1=$((0x$(printf "%02X" ${64//./ })));
        BIP2=$((0x$(printf "%02X" ${74//./ })));
        for ((I=BIP1; I<=BIP2; I++))
          do printf "%d.%d.%d.%d\n" $((I>>24)) $((I>>16&255)) $((I>>8&255)) $((I&255))
          done
  done < range

When I execute it the "range" file is empty. Looks like I using it wrong or something. Like I said I am new and need a little more help. Please bear with me a little more. Thanks!

Last edited by galford; 02-28-2016 at 06:26 AM..
# 5  
Old 02-28-2016
read reads from stdin, which you can redirect from a file ( with a structure as given in that thread ). If you don't, it reads from your keyboard; so - enter your starting and ending address.

DON'T modify the interior of the script as you did with 64 and 74.
# 6  
Old 02-28-2016
Quote:
Originally Posted by RudiC
read reads from stdin, which you can redirect from a file ( with a structure as given in that thread ). If you don't, it reads from your keyboard; so - enter your starting and ending address.

DON'T modify the interior of the script as you did with 64 and 74.
You mean like this?

./iprange 64.0.0.1 74.255.255.255

Please give me an example.
# 7  
Old 02-28-2016
Run it without the stdin redirection, and then enter the limits on the command line. As given, it is made for reading from a file so it doesn't prompt.
Code:
./iprange
64.0.0.1 74.255.255.255

Please be aware that this is quite some range; mayhap you try with narrower limits.
This User Gave Thanks to RudiC For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Hostsfile generator

Hello I use a bash script to creating the hosts file /etc/hosts But there is a bug inside my output and I want to fix this. My Array looks like this: 205,IP 111.122.133.20 205,HOST2 unas 205,HOST1 unas15533 205,COMMENT # UNAS 775,IP ... (9 Replies)
Discussion started by: Marti95
9 Replies

2. Shell Programming and Scripting

Sequence generator

Thanks Guys This really helped (5 Replies)
Discussion started by: robert89
5 Replies

3. Shell Programming and Scripting

time generator

Hi experts, I'd like to generate the table/file containing: number of milliseconds elapsed since midnight till midnight. It should contain 5 columns (hours minutes seconds milliseconds): Table will have theoretically 86 400 000 rows. My question is , is there somewhere the file or source... (7 Replies)
Discussion started by: hernand
7 Replies

4. Shell Programming and Scripting

Need specialized random string generator script

Hi, I need a script that will generate a set of random strings in sequence, with the ability to predetermine the length, quantity, and alphabet of individual string, and to use the outputs of earlier strings in the sequence to define the parameters of later strings. For examples, I might want... (5 Replies)
Discussion started by: vajrajames
5 Replies

5. What is on Your Mind?

Barcode Generator

QR Code Generator (0 Replies)
Discussion started by: Neo
0 Replies

6. Shell Programming and Scripting

Range generator

Dear All, I have a sorted file like 1 2 3 8 9 10 45 46 47 78 The output will be range like 1 3 8 10 45 47 78 78 (9 Replies)
Discussion started by: saifurshaon
9 Replies

7. Shell Programming and Scripting

awk, shell script reverse engineering app generator - project

Hi, this is fantastic forum for shell programming and scripting, so please let me to introduce you with my very old concept to have web form/s with radio, select, input fields and have an application generating valid, syntax error free scripting code. The same or alike questions are asked... (2 Replies)
Discussion started by: darius2
2 Replies

8. UNIX for Dummies Questions & Answers

date generator

Is there a command to generate the unix date that is in theshadow file?>? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

9. Cybersecurity

Password Generator

I need a great Password Generator program. I looked at a few of them, but none of them seemed to be what I wanted. So I have decided to write my own. (That's the cool thing about being a programmer....I always get what I want in software :) ) Do you have any password generators that you... (13 Replies)
Discussion started by: Perderabo
13 Replies
Login or Register to Ask a Question