INPUT: values separated by the tab,first row is the header
Code:
[DATE MARKET SIDE PRICE]
20110609 AS A 300.5000
20110609 AS R 200.5000
20110609 BR A 111.5000
20110609 BR R 222.5000
20110610 AS A 100.5500
20110610 AS R 150.5500
20110610 BR A 199.5000
20110610 BR R 288.5000
20110611 AS A 50.0000
20110611 AS R 50.0000
20110611 BR A 98.0000
20110611 BR R 97.0000
20110612 AS A 90.0000
20110612 AS R 80.0000
20110612 CO A 12.0000
20110612 CO R 13.0000
20110612 DE A 112.0000
20110612 DE R 113.0000
20110613 DE A 38012.6920
20110613 DE A 38012.6920
etc.
OUTPUT:
I need to calculate a three day AVERAGE PRICE for each day where the SIDE and the MARKET are the same (three day is just example - it should be CUSTOMIZABLE) :
Example:
For date 20110612 and side A and market AS - we will sum prices for (0612 +0611+0610) on the A side on the AS market,
so the summary will be (90+50+100,55 = 240,55)=SUM_SIDE_A then calculate the average which is SUM_SIDE_A/3 = 80,1833
for R side it will be (80+50+150,55=280,55=SUM_SIDE_R)/3 = 93.51
etc. for each day/market/side.
For days 20110609 or 20110610 when there is no record 3 days past, we will simple use the all existing records before.
Example : 20110609 : A side, market AS -> 300.5/ 1 =300.5 , 20110610 : 401.05/2 =200.525
OUTPUT should look like this: tab separated values, instead of 'xxx' should be similar summaries for other markets.
output should be sorted by date ascending , market alphabetically
Code:
[DAE MARKET AVERAGE_SIDE_A AVERAGE_SIDE_R]
20110609 AS 300.5000 200.5000
20110609 BR xxx xxx
20110610 AS 200.525 175.525
20110610 BR xxx xxx
20110611 AS 150.3500 133.6833
20110611 BR xxx xxx
20110612 AS 80.1330 93.5156
20110612 BR xxx xxx
20110612 CO xxx xxx
20110612 DE xxx xxx
20110613 AS xxx xxx
20110613 DE xxx xxx
etc.
In my real input there are of course hundreds of date and dozen of markets.
Thanks a lot for all replies
Guys,
I need to roll up data within the file and build a new file with the output and the same format as the original file.
The data should be rolled up for each unique combination of ord,line,date and hour.. The last column appr is always " "
Below is the format
Original File:
... (8 Replies)
hi all,
i start with solaris 11 and i am disapointed by the change on ip managing.
i want to set a ipmp over tow aggregate but i dont find any doc and i am lost with the new commande
switch1
net0 aggregate1 |
net1 aggregate1 |-----|
|... (1 Reply)
Hi...
I am trying extract data using 2 files..
1. Data file - DATA.TXT containing data to be extracted
2. Column file - LIST.TXT header column to be extracted
output not coming properly..
if the header field name matches with data file header extract data...this actually I wanted ...
... (7 Replies)
hi guys,
i need a script that does a simple task on multiple aix servers.
if possible with both telnet and ssh.
the simple task i wanna do is connect to a server and run "ifconfig -a" and get the output. nextweek i need to do similar jobs on like 50 servers... :(
can anybody help me with making... (2 Replies)
Hi guys,
could someone tell me how i could create a label like this:
mybox01, mybox04, mybox12, mybox10 when i have the values "mybox1", "mybox4","mybox12","mybox10" as a prefix and a number. If the number is below 10 then add a zero before the number?
A one liner?
A long approach is to... (2 Replies)
Hi
I have a question related to load balancing.I have two separate internet connections with 2Mbps speed and i would like to aggregate this two connections intro one connection with 4Mbps.Is it possible to do that, to put a Linux or Unix machine as a gateway?I read some stuff to split the... (3 Replies)
I have an task definition listing xml file that contains a list of tasks such as
<TASKLIST
<TASK definition="Completion date" id="Taskname1" Some other
<CODE name="Code12"
<Parameter pname="Dog" input="5.6" units="feet" etc /Parameter>
<Parameter... (3 Replies)
Hy all,
I have a problem...can some one help me...
I have a file of records sort:
30|239|ORD|447702936929 |blackberry.net |20080728|141304|00000900|2|0000000000000536|28181|0000000006|0000000001|10|1
30|239|ORD|447702936929 |blackberry.net ... (4 Replies)
Hello how are you, i have a question i have a file ale.log and i want to agregate a title and later a space when the text is over and put another title (when the text is over) how can i do this? thank you
Example
Last ------>(Title) i want to agregate
pupu pupu pupu pupu... (1 Reply)
I have a file contains
TASK gsnmpproxy {
CommandLine = $SMCHOME/bin/gsnmpProxy.exe
}
TASK gsnmpdbgui {
CommandLine = $SMCHOME/bin/gsnmpdbgui.exe
I would like to comment and than uncomment specific task eg TASK gsnmpproxy
Pls suggest how to do in shell script (9 Replies)