Sponsored Content
Top Forums Shell Programming and Scripting Script to compact information ! Post 302368860 by rdcwayx on Thursday 5th of November 2009 08:31:27 PM
Old 11-05-2009
Code:
$ awk -F, '{
{date[$3]=$3}
{if (open[$3]=="") open[$3]=$5}
{if (high[$3]<$6) high[$3]=$6}
{if (low[$3]=="") low[$3]=$7}
{if (low[$3]>$7) low[$3]=$7}
{closep[$3]=$8}
{vol[$3]+=$9}
}
END {for (i in open) {print "EUR_USD,D",date[i],open[i],high[i],low[i],closep[i],vol[i]}}
' OFS="," EUR_USD-1H.txt |sort -t, -k3r |head

EUR_USD,D,<date>,<open>,<high>,<low>,<close>,0
EUR_USD,D,11/04/2009,1.4764,1.4805,1.4740,1.4796,3046
EUR_USD,D,11/03/2009,1.4635,1.4732,1.4631,1.4731,12887
EUR_USD,D,11/02/2009,1.4783,1.4844,1.4727,1.4772,11633
EUR_USD,D,11/01/2009,1.4728,1.4741,1.4703,1.4708,1297
EUR_USD,D,10/30/2009,1.4804,1.4820,1.4711,1.4715,10863
EUR_USD,D,10/29/2009,1.4728,1.4858,1.4718,1.4838,10865
EUR_USD,D,10/28/2009,1.4779,1.4815,1.4690,1.4716,12978
EUR_USD,D,10/27/2009,1.4876,1.4887,1.4770,1.4821,12250
EUR_USD,D,10/26/2009,1.5024,1.5035,1.4844,1.4859,10336


Last edited by rdcwayx; 11-05-2009 at 09:38 PM..
 

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
CPG_ZCB_ALLOC(2009-04-15)												 CPG_ZCB_ALLOC(2009-04-15)

NAME
cpg_zcb_alloc - Allocates a zero copy buffer #include <corosync/cpg.h> int cpg_zcb_alloc(cpg_handle_t handle, size_t size, void **buffer); DESCRIPTION
The cpg_zcb_alloc function will allocate a zero copy buffer for use with the cpg_zcb_mcast_joined(3) funtion. This buffer should not be used in another thread while a cpg_zcb_mcast_joined operation is taking place on the buffer. The buffer is allocated via operating system mechanisms to avoid copying in the IPC layer. The argument handle describes the handle on which the buffer will be allocated. The argument size requests a buffer of size be allocated. The buffer argument is set to the buffer address that is allocated by this operatoin. RETURN VALUE
This call returns the CPG_OK value if successful, otherwise an error is returned. ERRORS
The errors are undocumented. SEE ALSO
cpg_overview(8), cpg_initialize(3), cpg_finalize(3), cpg_fd_get(3), cpg_dispatch(3), cpg_join(3), cpg_leave(3), cpg_mcast_joined(3), cpg_membership_get(3) cpg_zcb_alloc(3) cpg_zcb_free(3) cpg_zcb_mcast_joined(3) cpg_context_get(3) cpg_context_set(3) cpg_local_get(3) Corosync Cluster Engine Programmer's Manual corosync Man Page CPG_ZCB_ALLOC(2009-04-15)
All times are GMT -4. The time now is 11:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy