2006-10-01,10.72,10.70,10.72,10.69,10.66,10.65,10.66,10.66,10.66,10.64,10.64,10.63,10.63,10.64,10.64,10.65,10.68,10.68,10.67,10.68,10.69,10.69,10.69,10.67
2006-10-02,10.67,10.67,10.67,10.67,10.68,10.67,10.68,10.68,10.68,10.68,10.68,10.68,10.68,10.68,10.64,10.64,10.69,10.75,10.74,10.70,10.69,10.71,10.70,10.70
2006-10-03,10.70,10.70,10.71,10.72,10.72,10.71,10.72,10.72,10.72,10.72,10.72,10.72,10.72,10.72,10.71,10.71,10.71,10.72,10.73,10.73,10.72,10.70,10.70,10.71
2006-10-04,10.72,10.73,10.73,10.73,10.72,10.73,10.72,10.72,10.72,10.73,10.72,10.72,10.72,10.72,10.72,10.72,10.70,10.70,10.69,10.69,10.70,10.71,10.73,10.73
2006-10-05,10.74,10.75,10.71,10.69,10.71,10.74,10.75,10.74,10.71,10.70,10.69,10.70,10.69,10.70,10.70,10.71,10.72,10.72,10.71,10.70,10.70,10.71,10.72,10.71
2006-10-06,10.70,10.70,10.72,10.74,10.74,10.74,10.74,10.72,10.72,10.69,10.66,10.67,10.72,10.73,10.73,10.71,10.68,10.71,10.75,10.77,10.75,10.73,10.72,10.69
The awk script intends to change this wide format to a long format. Each
line will have the date ($1), an added hour, then the numeric value ($3).
I've tried two versions of the script, one using ';' to separate lines,
the other using '\n' to separate lines. Both print only the first value for
each date; e.g.,
2006-10-01,00:00,307.65
2006-10-02,00:00,307.6
2006-10-03,00:00,307.63
2006-10-04,00:00,307.65
2006-10-05,00:00,307.67
2006-10-06,00:00,307.63
The awk script, 'wide2long.awk':
#!/usr/bin/awk
BEGIN { FS="," }
{ print $1",00:00,"$2+"296.93\n"
$1",01:00,"$3+"296.93\n"
$1",02:00,"$4+"296.93\n"
$1",03:00,"$5+"296.93\n"
$1",04:00,"$6+"296.93\n"
$1",05:00,"$7+"296.93\n"
$1",06:00,"$8+"296.93\n"
$1",07:00,"$9+"296.93\n"
$1",08:00,"$10+"296.93\n"
$1",09:00,"$11+"296.93\n"
$1",10:00,"$12+"296.93\n"
$1",11:00,"$13+"296.93\n"
$1",12:00,"$14+"296.93\n"
$1",13:00,"$15+"296.93\n"
$1",14:00,"$16+"296.93\n"
$1",15:00,"$17+"296.93\n"
$1",16:00,"$18+"296.93\n"
$1",17:00,"$19+"296.93\n"
$1",18:00,"$20+"296.93\n"
$1",19:00,"$21+"296.93\n"
$1",20:00,"$22+"296.93\n"
$1",21:00,"$23+"296.93\n"
$1",22:00,"$24+"296.93\n"
$1",23:00,"$25+"296.93" }
I've looked in my awk book and searched the web (perhaps with the wrong
search terms) and haven't found my syntactical error. Help is needed.
Rich
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug