On Tue, 19 Jun 2018, Robert Citek wrote:

A quick pass.  Needs testing and refactoring.

$2 != "16.00" { print ; next }
flag == 0 && $2 == "16:00" { print ; flag=1 ; next }
flag == 1 && $2 == "16:00" { $2=="17:00"; print; flag=0 ; next }

  Thanks, Robert. I tried variations of this using if and regex for the
patterns, but they didn't work. Here's my test file (cleverly named
test.dat):

2012-10-01,14:00,90.7999
2012-10-01,15:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,18:00,90.8091
2012-10-01,19:00,90.8030

  Your script did what mine did, added two more rows with 16:00:

2012-10-01,14:00,90.7999
2012-10-01,15:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,16:00,90.8121
2012-10-01,18:00,90.8091
2012-10-01,19:00,90.8030

  Wrapping the patterns in parentheses and forward slashes makes no
difference. I'm sure the correct script will appear to be obvious once I
learn how to do this.

Best regards,

Rich

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to