..I need to modify several CSV’s as follow’s…
This is what I have:
2012-08-13 00:15:15; 768.548
2012-08-13 00:30:15; 768.625
2012-08-13 00:45:15; 768.667
2012-08-13 01:00:15; 768.729
2012-08-13 01:15:15; 768.785
2012-08-13 01:30:15; 768.827
But what I need for my analyses is this:
2012-08-13 00:15:15; xxx
2012-08-13 00:30:15; 0.077
2012-08-13 00:45:15; 0.042
2012-08-13 01:00:15; 0.062
2012-08-13 01:15:15; 0.056
2012-08-13 01:30:15; 0.042
What I need to do is subtract the actual line from the line above.
I’ve done some simple shell script’s which calculate the sum of those file’s but never did something that complex…
And there’s an extra challenge: the first line/value need’s to be subtracted by the value from the day before which is in another CSV.
Hope you can help
How about a little awk script?
As for the first line (where it’s
xxxat the moment), I’d write a little shell function:and then modify the snippet above to
and then all you need to do is obtain the combinations of
PREVIOUSandTHIS_FILEfor each call. Also note that the very first file must be processed with the untweaked snippet above (as there is no previous value).