[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] Empty output line when using -o/-p in combination with -l
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] Empty output line when using -o/-p in combination with -l/@load |
Date: |
Tue, 02 Apr 2013 20:46:13 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi.
Thanks for the report. I have just pushed a fix, so a "git pull ; make"
should do the trick for you.
Thanks!
Arnold
> Date: Sun, 31 Mar 2013 17:50:58 -0300
> From: Hermann Peifer <address@hidden>
> To: address@hidden
> Subject: [bug-gawk] Empty output line when using -o/-p in combination with
> -l/@load
>
> Hi,
>
> I just noted that an additional empty output line is generated when
> using -o/-p in combination with -l/@load. I found this issue when
> loading the xml extension for processing some GPX data, see [1].
>
> The same behaviour occurs when loading the ordchr extension, see [2] for
> an example.
>
> Regards, Hermann
>
>
> [1]
>
> $ awk -f test.awk data.gpx
> -29.498221 -51.646213 -29.498362 -51.646196
> -29.498362 -51.646196 -29.498435 -51.646128
> $ awk -p -f test.awk data.gpx
> -29.498221 -51.646213 -29.498362 -51.646196
> -29.498362 -51.646196 -29.498435 -51.646128
>
> $ cat test.awk
> # gawk profile, created Sun Mar 31 13:28:21 2013
>
> # Loaded extensions (-l and/or @load)
>
> @load "xml"
> # Rule(s)
>
> XMLSTARTELEM == "trkseg" {
> lat1 = lon1 = ""
> }
>
> XMLSTARTELEM == "trkpt" {
> if (lat1 lon1) {
> print lat1, lon1, XMLATTR["lat"], XMLATTR["lon"]
> }
> lat1 = XMLATTR["lat"]
> lon1 = XMLATTR["lon"]
> }
>
> $ cat data.gpx
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <gpx xmlns="http://www.topografix.com/GPX/1/1" creator="Nuvi" version="1.1">
> <trk>
> <trkseg>
> <trkpt lat="-29.498221" lon="-51.646213">
> <ele>307.308044</ele>
> <time>2013-03-30T11:51:26</time>
> </trkpt>
> <trkpt lat="-29.498362" lon="-51.646196">
> <ele>316.246582</ele>
> <time>2013-03-30T11:51:33</time>
> </trkpt>
> <trkpt lat="-29.498435" lon="-51.646128">
> <ele>321.724426</ele>
> <time>2013-03-30T11:51:41</time>
> </trkpt>
> </trkseg>
> </trk>
> </gpx>
>
>
> [2]
>
> $ awk -lordchr 'BEGIN{ printf("The numeric value of ?A? is %d\n",
> ord("A")) }'
> The numeric value of ?A? is 65
> $ awk -o -lordchr 'BEGIN{ printf("The numeric value of ?A? is %d\n",
> ord("A")) }'
> The numeric value of ?A? is 65
>
> $
- Re: [bug-gawk] Empty output line when using -o/-p in combination with -l/@load,
Aharon Robbins <=