From a58577fba180a08ebc0fcf43be8a99996359966f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 25 Sep 2016 20:22:27 -0700 Subject: doc: fconv examples. * txr.1: New examples for awk macro fconv. --- txr.1 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/txr.1 b/txr.1 index bea89447..b6499744 100644 --- a/txr.1 +++ b/txr.1 @@ -39242,6 +39242,31 @@ The return value of is .codn f . +.TP* Examples: + +.cblk + ;; convert up to first three fields to integer: + (awk ((fconv i i i))) + + ;; convert all fields to floating-point + (awk ((fconv : r :))) + + ;; convert first and second fields to integer + ;; from hexadecimal; + ;; convert last field to integer from octal; + ;; process pairs of fields in between + ;; these by leaving the first element of + ;; each pair unconverted and converting second + ;; to floating-point; + (awk ((fconv x x : - r : o))) + + ;; convert all fields, except the first, + ;; from integer, turning empty strings + ;; and non-integer junk as zero; + ;; leave first field unconverted: + (awk ((fconv - : iz))) +.cble + .coNP Examples of @ awk Macro Usage The following examples are .code awk -- cgit v1.2.3