Sponsored Content
Top Forums Shell Programming and Scripting Script to compact information ! Post 302368406 by csierra on Wednesday 4th of November 2009 08:23:55 PM
Old 11-04-2009
Question Script to compact information !

Hello Group,

Could you please help me with a shell script that condense in this case each 12 rows of hour information in only one row per day as following:

Final Fields in each row
1.Ticker Name
2. D (Daily)
3. Date
4. Open Price (The open price of the first record of the day)
5. High Price (The high price of all 12 rows of each day)
6. Low Price (The low price of all 12 rows of each day)
7. Close (The close price of the last record of the day)
8. Volume (The sum of all volume fields per day)

Final Result of the rows:
<ticker>,<per>,<date>,<open>,<high>,<low>,<close>,<vol>
EUR_USD,D,11/02/2009,1.4783,1.4844,1.4727,1.4772,11633
EUR_USD,D,11/03/2009,1.4732,1.4631,1.4631,1.4654,12887


The information that I want to process is in the following format:

<ticker>,<per>,<date>,<time>,<open>,<high>,<low>,<close>,<vol>
EUR_USD,I,11/02/2009,12:00,1.4783,1.4784,1.4766,1.4774,824
EUR_USD,I,11/02/2009,13:00,1.4773,1.4775,1.4746,1.4754,854
EUR_USD,I,11/02/2009,14:00,1.4753,1.4779,1.4739,1.4777,1320
EUR_USD,I,11/02/2009,15:00,1.4778,1.4844,1.4778,1.4817,2389
EUR_USD,I,11/02/2009,16:00,1.4816,1.4834,1.4813,1.4827,1302
EUR_USD,I,11/02/2009,17:00,1.4828,1.4831,1.4761,1.4762,1053
EUR_USD,I,11/02/2009,18:00,1.4761,1.4778,1.4731,1.4733,1148
EUR_USD,I,11/02/2009,19:00,1.4734,1.4771,1.4727,1.4751,1112
EUR_USD,I,11/02/2009,20:00,1.4752,1.4770,1.4747,1.4765,936
EUR_USD,I,11/02/2009,21:00,1.4764,1.4775,1.4763,1.4773,296
EUR_USD,I,11/02/2009,22:00,1.4772,1.4774,1.4760,1.4772,219
EUR_USD,I,11/02/2009,23:00,1.4773,1.4778,1.4769,1.4772,180
EUR_USD,I,11/03/2009,12:00,1.4635,1.4659,1.4631,1.4654,1207
EUR_USD,I,11/03/2009,13:00,1.4655,1.4668,1.4643,1.4651,1219
EUR_USD,I,11/03/2009,14:00,1.4652,1.4662,1.4633,1.4657,1690
EUR_USD,I,11/03/2009,15:00,1.4658,1.4696,1.4642,1.4676,2365
EUR_USD,I,11/03/2009,16:00,1.4675,1.4681,1.4631,1.4655,1592
EUR_USD,I,11/03/2009,17:00,1.4656,1.4695,1.4645,1.4685,1104
EUR_USD,I,11/03/2009,18:00,1.4686,1.4710,1.4678,1.4709,1006
EUR_USD,I,11/03/2009,19:00,1.4710,1.4732,1.4702,1.4702,988
EUR_USD,I,11/03/2009,20:00,1.4701,1.4722,1.4700,1.4711,723
EUR_USD,I,11/03/2009,21:00,1.4710,1.4732,1.4710,1.4721,371
EUR_USD,I,11/03/2009,22:00,1.4721,1.4727,1.4706,1.4716,395
EUR_USD,I,11/03/2009,23:00,1.4717,1.4732,1.4715,1.4731,227


I really appreciate your help and support

Sincerely,

Carlos S
 

6 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

formatting a Compact Flash in DOS format

:confused: I tryied to use the mount Command (and the msdos.utils) in Darwin 1.4 (OS X) to format a Compact Flash in DOS Format (I had already this native format but I changed it with Disk Utility in MacOS standard and the PC Card slot of a Windows 98-Laptop can't nore read the card) I want to... (1 Reply)
Discussion started by: dreamsurfer
1 Replies

2. Linux

How to Burn .gp Oracle 9.2.0.4.0 to Compact Disc Media on Windows Box

Hi All, I Downloaded Oracle 9.2.0.4.0 for Linux AS 4 and the file format is Directions to extract the files 1. Run "gunzip <filename>" on all the files. Eg. ship_9204_linux_disk1.cpio.gz 2. Extract the cpio archives with the command "cpio -idmv < <filename>" Eg. cpio -idmv... (0 Replies)
Discussion started by: prakashpichika
0 Replies

3. UNIX for Dummies Questions & Answers

User information script

Hi Guys, I just started learning unix and was wondering if anyone can assist me with my User info script.The script file lets the user input their personal information (Their name, address, phone number etc...). The script will then ask the user to input the info again if the input is incorrect... (2 Replies)
Discussion started by: rc1138
2 Replies

4. Shell Programming and Scripting

Compact 3-D output from a big input like:

Hi Experts!!!! Tried a lot but in vein,no success, please help to achieve this LOGIC behind is first field is reffrance row field, the second field shoud be made titles of coulmn and the the third field is made as matrix value. And if they dont match the matrix value should be 0. (Unix (Shell,... (1 Reply)
Discussion started by: ashis.tewari
1 Replies

5. Ubuntu

Format a compact flash card in Ubuntu

I need some assistance formatting a compact flash card in Ubtunu. I connect up the CF card through a USB reader. Ubuntu recognizes the reader usb device, but does not "mount" the CF card as a device. The CF card was formatted in FAT32 format. Any help would be greatly appreciated.... (3 Replies)
Discussion started by: genesis211
3 Replies

6. Shell Programming and Scripting

Compact script with array - Good idea?

Hi, I have a shell script where a lot of the code is repeated. I wanted to make the code much more compact so I spoke to a guy and he suggested using arrays, like follows: #!/bin/bash readonly -a nginx=('nginx' '--prefix=/opt' '-j 4' 'http://nginx.org/download/nginx-1.2.2.tar.gz' )... (2 Replies)
Discussion started by: Spadez
2 Replies
LQR_CARVER_GET_COL_DEPTH(3)				     LqR library API reference				       LQR_CARVER_GET_COL_DEPTH(3)

NAME
lqr_carver_get_col_depth - get the colour depth of a LqrCarver object SYNOPSIS
#include <lqr.h> LqrColDepth lqr_carver_get_col_depth(LqrCarver* carver); DESCRIPTION
The function lqr_carver_get_col_depth returns the colour depth of the image contained in the LqrCarver object pointed to by carver. SEE ALSO
LqrColDepth(3), lqr_carver_get_width(3), lqr_carver_get_height(3), lqr_carver_get_ref_width(3), lqr_carver_get_ref_height(3), lqr_carver_get_channels(3), lqr_carver_get_enl_step(3), lqr_carver_get_orientation(3) COPYRIGHT
Copyright (C) 2007-2009 Carlo Baldassi LqR library 0.4.1 API (3:1:3) 10 Maj 2009 LQR_CARVER_GET_COL_DEPTH(3)
All times are GMT -4. The time now is 10:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy