LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-24-2008, 09:59 PM   #1
hchoonbeng
LQ Newbie
 
Registered: Sep 2008
Posts: 15

Rep: Reputation: 0
how to auto increment 13 digit hexadecimal using script


Hi I need to test my prog with all possible combination of 13 digits hexadecimal and later consolidation the all results in txt format into one txt report. how to do it using scipt? eg.

for( i in 0x0000000000000 to 0xFFFFFFFFFFFFF)
{
run prog(i);
output results_i.txt;
}



thanks
 
Old 09-24-2008, 11:03 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,063

Rep: Reputation: 381Reputation: 381Reputation: 381Reputation: 381
Quote:
Originally Posted by hchoonbeng View Post
Hi I need to test my prog with all possible combination of 13 digits hexadecimal and later consolidation the all results in txt format into one txt report. how to do it using scipt? eg.

for( i in 0x0000000000000 to 0xFFFF.FFFF.FFFF.F)
{
run prog(i);
output results_i.txt;
}



thanks
Bash is not very good at maths, however, you can always do something like this:

Code:
for ((i=0;i<=255;i++)); do printf "%.2X\n" $i; done
You get the idea. You can save that result in a variable and pass it to your program:

Code:
for ((i=0;i<=255;i++))
do
  j=printf "%.2X\n" $i
  myprog $j
  #whatever else
done

I don't know of a way to use hex on the loop control, however that shouldn't be a problem if you know the starting and ending numbers.

Anyway, are you sure that you want to loop 2^(4*13) times using bash? That will take quite a bit of time and cpu power...

Last edited by i92guboj; 09-25-2008 at 07:37 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script for converting Hexadecimal IP to Decimal IP PKrishna Linux - Newbie 5 07-04-2008 07:49 PM
SQLite how to get last "AUTO INCREMENT" value blackman890 Programming 1 12-11-2006 01:22 PM
auto run script muleypr Linux - General 16 10-30-2006 06:14 AM
Auto-execute script ishcoleobo Linux - Software 2 12-10-2005 06:26 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 04:51 PM


All times are GMT -5. The time now is 11:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration