Results 1 to 4 of 4
Hi All,
I have a list of timebased values in below form:
20/Dec/2011:10:16:29 9
20/Dec/2011:10:16:30 13
20/Dec/2011:10:16:31 13
20/Dec/2011:10:16:32 9
20/Dec/2011:10:16:33 13
20/Dec/2011:10:16:34 14
20/Dec/2011:10:16:35 6
20/Dec/2011:10:16:36 7
20/Dec/2011:10:16:37 16
...
- 01-15-2012 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 11
Processing Timebased values
Hi All,
I have a list of timebased values in below form:
20/Dec/2011:10:16:29 9
20/Dec/2011:10:16:30 13
20/Dec/2011:10:16:31 13
20/Dec/2011:10:16:32 9
20/Dec/2011:10:16:33 13
20/Dec/2011:10:16:34 14
20/Dec/2011:10:16:35 6
20/Dec/2011:10:16:36 7
20/Dec/2011:10:16:37 16
20/Dec/2011:10:16:38 5
20/Dec/2011:10:16:39 7
20/Dec/2011:10:16:40 15
20/Dec/2011:10:16:41 12
20/Dec/2011:10:16:42 13
20/Dec/2011:10:16:43 11
20/Dec/2011:10:16:44 6
20/Dec/2011:10:16:45 7
20/Dec/2011:10:16:46 9
20/Dec/2011:10:16:47 14
20/Dec/2011:10:16:49 6
20/Dec/2011:10:16:50 11
20/Dec/2011:10:16:51 15
20/Dec/2011:10:16:52 10
20/Dec/2011:10:16:53 16
20/Dec/2011:10:16:54 12
20/Dec/2011:10:16:55 8
20/Dec/2011:10:16:56 12
20/Dec/2011:10:16:57 7
20/Dec/2011:10:16:58 9
20/Dec/2011:10:16:59 14
20/Dec/2011:10:17:00 10
20/Dec/2011:10:17:01 11
20/Dec/2011:10:17:02 9
20/Dec/2011:10:17:03 10
20/Dec/2011:10:17:04 11
20/Dec/2011:10:17:05 9
20/Dec/2011:10:17:06 13
20/Dec/2011:10:17:07 12
20/Dec/2011:10:17:08 10
20/Dec/2011:10:17:09 11
20/Dec/2011:10:17:10 14
Second column contains value against each second. Values are there for complete month and for each and every second. I want to add these values -
Per minute basis. [for 00 - 59 seconds ]
Per hour basis [ for 00 - 59 minutes ]
Per Day basis. [ for 0 - 24 hours ]
Please help.
- 01-15-2012 #2Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
I don't understand exactly what you're after, but why don't you have a crack at it, and show us where you're stuck, or if you have tried something - show us.
If you don't even know where to start, i'd suggest you start with a bash shell script that utilizes for loops and awk/sed/grep to get the values you need, and bc to do the math.
- 01-17-2012 #3Just Joined!
- Join Date
- Jul 2010
- Posts
- 11
Thanks for your post mpapet. I did it through using - awk/grep in bash shell.
Can you brief me to input this data on SQL and retrieving it
- 01-17-2012 #4Linux Guru
- Join Date
- May 2011
- Posts
- 1,843
That is a tall order. I assume you already have a SQL server installed and running? Do you already have a suitable table in your database with all the proper columns defined properly? You may need to start there.
Originally Posted by UnixDomain
Assuming your database is ready to receive input, then you can plan on good method for loading your data into it. I'd start by saving the script output to a file. Then read up on your SQL documentation to see if it supports loading data from file. It likely does. For example, in MySQL, you can do something like:
That will load the contents of the file "my_data.txt" (which must be in the current working directory) into the table "my_table", which is in the database "my_db". You need special privileges to use INFILE on tables, be ware. You'll also need to have the data in the text file to be of the proper format (comma-delimited or whatever).Code:LOAD DATA INFILE 'my_data.txt' INTO TABLE my_db.my_table;
Edit: Read up on MySQL's INFILE more here: MySQL 5.1 Reference ManualLast edited by atreyu; 01-17-2012 at 03:19 AM. Reason: link


Reply With Quote