time generator


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting time generator
# 1  
Old 06-02-2011
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 where this things are already ready to download, or what would be the fastest/easiest way to generate such a huge file?

Thanks for all comments.
# 2  
Old 06-02-2011
is that you looking for ?

i dont know how much time it will take to complete

Code:
echo "hour\tminutes\tseconds\tmiliseconds" > output.txt
for hour in `seq -w 00 23`
do
 for minutes in `seq -w 00 59`
 do
  for seconds in `seq -w 00 59`
  do
   for miliseconds in `seq -w 000 999`
   do
    echo "$hour\t$minutes\t$seconds\t$miliseconds >> ouptut.txt
   done
  done
 done
done

This User Gave Thanks to itkamaraj For This Post:
# 3  
Old 06-02-2011
Thanks
# 4  
Old 06-02-2011
Quote:
Originally Posted by hernand
Hi, the code is giving error:

line 10: unexpected EOF while looking for matching `"'
line 15: syntax error: unexpected end of file
Try this..

Code:
echo "hour\tminutes\tseconds\tmiliseconds" > output.txt
for hour in `seq -w 00 23`
do
 for minutes in `seq -w 00 59`
 do
  for seconds in `seq -w 00 59`
  do
   for miliseconds in `seq -w 000 999`
   do
    echo "$hour\t$minutes\t$seconds\t$miliseconds" >> output.txt
   done
  done
 done
done

This User Gave Thanks to itkamaraj For This Post:
# 5  
Old 06-02-2011
Hi
The output looks like this:

Code:
00\t00\t00\t000
00\t00\t00\t001
00\t00\t00\t002
00\t00\t00\t003
00\t00\t00\t004
00\t00\t00\t005
00\t00\t00\t006

Thanks for reply
# 6  
Old 06-02-2011
use
Code:
echo -e

This User Gave Thanks to itkamaraj For This Post:
# 7  
Old 06-02-2011
Thanks its working fine now , I'm just wondering how long could it takeSmilie

EDIT: It took almost 7 hours Smilie

Last edited by hernand; 06-06-2011 at 08:17 AM..
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

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

Sequence generator

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

4. Shell Programming and Scripting

At A Glance Coloured Real Time Bargraph Generator...

Not sure if anyone is interested but I am just getting into UNIX like shell scripting... I have great interest in pseudo-animations in text mode and accessing HW like /dev/dsp for example... ... Have fun, I do... ;o) # !/bin/sh # # Bargraph_Generator.sh # # A DEMO 6 bit coloured... (0 Replies)
Discussion started by: wisecracker
0 Replies

5. Cybersecurity

swordfish --- a password generator

Here is my new password generation script. The attachment, swordfish.txt, is in dos format. Remember that you need to use dos2unix or flip or something to get it into unix format. The script is self documenting. It has an extensive help system built-in. And you can run: swordfish "set... (8 Replies)
Discussion started by: Perderabo
8 Replies

6. What is on Your Mind?

Barcode Generator

QR Code Generator (0 Replies)
Discussion started by: Neo
0 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
Login or Register to Ask a Question