[PLUG] An awk question: multiple actions acting on each line.

David Fleck david.fleck at mchsi.com
Sun Jul 22 20:34:26 UTC 2018


On Sun, 2018-07-22 at 15:24 -0500, David Fleck wrote:

> Rich-
> I got the attached script to do what you want (I think).  


Looks like attachments aren't allowed (?). Anyway, here's attempt #2,
inline:

#!/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"}

You may be able to restore some of the whitespace.  I took it all out
because otherwise lines wouldn't all start in column 1.





More information about the PLUG mailing list