A variable and sum of its value in a huge data.

Hi Experts,

I got a question..

In the following output of `ps -elf | grep DataFlow` I get:-

242001 A mqsiadm 2076676 1691742 0 60 20 26ad4f400 130164 * May 09 - 3:02 DataFlowEngine EAIDVBR1_BROKER 5e453de8-2001-0000-0080-fd142b9ce8cb VIPS_INQ1 0
242001 A mqsiadm 2081016 1691742 0 60 20 372c6c400 81248 * May 09 - 1:03 DataFlowEngine EAIDVBR1_BROKER 6fc4c4d3-2001-0000-0080-867a1d98f606 TEST2 1
242001 A mqsiadm 2088998 1691742 0 60 20 3facfd400 60924 * May 09 - 1:19 DataFlowEngine EAIDVBR1_BROKER c7072ee8-2001-0000-0080-ecd80b0acb20 EAI_CONTROL 0
242001 A mqsiadm 2093084 1691742 0 60 20 3fad7d400 59072 * May 09 - 1:12 DataFlowEngine EAIDVBR1_BROKER 18b140e8-2001-0000-0080-d0035678abd2 WEBSERVICES 0
242001 A mqsiadm 2117660 1691742 0 60 20 1e2d3e400 70436 * May 09 - 1:18 DataFlowEngine EAIDVBR1_BROKER 2fe72de8-2001-0000-0080-ecd80b0acb20 DISCOUNTING_CFC_APPID 0
242001 A mqsiadm 2121744 1691742 0 60 20 372d6c400 84244 * May 09 - 1:57 DataFlowEngine EAIDVBR1_BROKER a62a39e8-2001-0000-0080-ecd80b0acb20 UTILITY 0
242001 A mqsiadm 2125838 1691742 0 60 20 31ad61400 69952 * May 09 - 1:34 DataFlowEngine EAIDVBR1_BROKER 79922de8-2001-0000-0080-ecd80b0acb20 CTAX 0
242001 A mqsiadm 2134042 1691742 0 60 20 2c2dda400 93060 * May 09 - 2:38 DataFlowEngine EAIDVBR1_BROKER 318d32e8-2001-0000-0080-ecd80b0acb20 IDS_INQ1 0
242001 A mqsiadm 2138132 1691742 0 60 20 42d8a400 92372 * May 09 - 2:24 DataFlowEngine EAIDVBR1_BROKER d6d529e8-2001-0000-0080-bbfc9e717a98 CON_PAYOFFS2 0
242001 A mqsiadm 2146328 1691742 0 60 20 3cad7b400 80092 * May 09 - 1:34 DataFlowEngine EAIDVBR1_BROKER 3ed728e8-2001-0000-0080-bbfc9e717a98 CON_INQ 0

Above BOLD faced I got to pick and RED faced are the memory consumed by those Execution Groups (that are BOLD Faced).
I got to pick "each BOLD faced variable" and got to sum the RED faced value, for the interval of an hour. An hour can be divided into 6 subintervals of 10 seconds.

Please tell me how to achieve that.
I guess array can be used here.

Thanks in Advance.:b:

you can format your ps output using -o option, eg ps -eo args,pid ...check the man page for more info

Suppose I got 2 columns that I highlighted above, then what about the sum of each those BOLD faced variables and its value (in RED face) for an hour, with a gap of 10 seconds.
:confused:

u can try this:

awk '{SUM += $10; print $19} END {print SUM}'

it'll print the BOLD value and sum the RED faced value ^^

I think , you dont get the problem...
Problem is to pick "each" BOLD Faced variable, then get its RED faced value.
Suppose : VIPS_INQ1 is the variable whose RED faced value is 130164 . Now for the next an hour we got to get such RED Faced values for that VIPS_INQ1 for the interval of 5 minutes.
At the End.. we would have 12 RED Faced values for VIPS_INQ1, that we got to sum in the end.

Do the same for each BOLD faced one for an hour and after getting all the RED Faced values for those, sum them.

Hope I am clear.
Please suggest the solution.
:b:

Schedule a cron job which dumps the ps output in a file, like that:

ps -whatever >> psoutput.txt

After you have collected all the needed data in psoutput.txt, the file can be easily processed by a suitable awk program.