Sequence generator


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sequence generator
# 1  
Wrench Sequence generator

Thanks Guys

This really helped

Last edited by robert89; 02-19-2013 at 08:08 PM..
# 2  
I don't know how many numbers you want to generate, but here is an example for 789-800:
Code:
a="00789"
l=${#a}
while [ $a -le 800 ]; do printf "%0${l}d\n" $(( a++ )); done

# 3  
You should probably post your script first, but...
Code:
 echo '00789' | awk '{printf("%05d\n", $1+1)}'

# 4  
thanks

Thanks guys . This really helped . Thanks a lot .
# 5  
Why did you remove the contents of the original post? Now no one will know what was this code's purpose...
# 6  
bash has a builtin that is a sequence generator:
play with this:
Code:
echo {00800..00900}
echo {1,2,3}
echo {1,2,3}{1,2,3}
echo {A..Z}

So,
Code:
for i in  {nn..mm} 
do
   # do something with i;
   echo $i
done

Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #468
Difficulty: Medium
Both Ethernet and IPv4 use an all-zeros broadcast address to indicate a broadcast packet.
True or False?

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

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: 64.1.1.2 64.1.1.3 ............. ............. 74.255.255.254 74.255.255.255 (line-by-line) ... (7 Replies)
Discussion started by: galford
7 Replies

3. Shell Programming and Scripting

find common entries and match the number with long sequence and cut that sequence in output

Hi all, I have a file like this ID 3BP5L_HUMAN Reviewed; 393 AA. AC Q7L8J4; Q96FI5; Q9BQH8; Q9C0E3; DT 05-FEB-2008, integrated into UniProtKB/Swiss-Prot. DT 05-JUL-2004, sequence version 1. DT 05-SEP-2012, entry version 71. FT COILED 59 140 ... (1 Reply)
Discussion started by: manigrover
1 Replies

4. 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

5. What is on Your Mind?

Barcode Generator

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

6. Shell Programming and Scripting

Random Sentence Generator

Hi, I need to create a table with random sentences. I need lines that are upto 1000 characters in lenght. I need a random sentence generator that will create sentences and output it to a text file. The sentences should be of lenght varying from 1 to 1000. Does anyone know how this can be... (7 Replies)
Discussion started by: kaushys
7 Replies

7. 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

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

Featured Tech Videos