Can someone help me with a syntax error on this small gawk script?
My input is like:
"ITEM1","",-6
-79.471207878102078,40.185904961536473
-79.471110437609283,40.186013888181662
-79.471012969863153,40.186122801305608
-79.470915474880968,40.186231700890886
-79.470817952283511,40.18634058672292
-79.470720401289327,40.186449458386832
"ITEM2","",-5
-79.480588912690266,40.137327883976646
-79.480520795075009,40.137752518467074
-79.480078078737492,40.140727925559467
-79.431175980661493,40.212378260510036
-79.430817901029741,40.212711867264595
"ITEM3","",-4
-79.499865919237621,40.096682432318033
-79.499623533047696,40.097444696601713
-79.499371738211565,40.098205286381464
-79.499112753934597,40.098964553407647
and I want to print the "ITEM..." record and then print the group of following points in reverse order"
Here's my script:
{
if (match($0, "^\"")) { print;next
{ line[NR] = $0 }
END { for (i=NR;i>0;i--)
print line }
}
Thanks for any suggestions!
My input is like:
"ITEM1","",-6
-79.471207878102078,40.185904961536473
-79.471110437609283,40.186013888181662
-79.471012969863153,40.186122801305608
-79.470915474880968,40.186231700890886
-79.470817952283511,40.18634058672292
-79.470720401289327,40.186449458386832
"ITEM2","",-5
-79.480588912690266,40.137327883976646
-79.480520795075009,40.137752518467074
-79.480078078737492,40.140727925559467
-79.431175980661493,40.212378260510036
-79.430817901029741,40.212711867264595
"ITEM3","",-4
-79.499865919237621,40.096682432318033
-79.499623533047696,40.097444696601713
-79.499371738211565,40.098205286381464
-79.499112753934597,40.098964553407647
and I want to print the "ITEM..." record and then print the group of following points in reverse order"
Here's my script:
{
if (match($0, "^\"")) { print;next
{ line[NR] = $0 }
END { for (i=NR;i>0;i--)
print line }
}
Thanks for any suggestions!