summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-25 20:22:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-25 20:22:27 -0700
commit43d519c91ca21791e4f395f87522edcde8e933dc (patch)
tree262e90a4ce637ae3f8a35e4412597cd30311c4e2
parent79a7ab2bf22a410626b64fec4c5a2111776478e8 (diff)
downloadtxr-43d519c91ca21791e4f395f87522edcde8e933dc.tar.gz
txr-43d519c91ca21791e4f395f87522edcde8e933dc.tar.bz2
txr-43d519c91ca21791e4f395f87522edcde8e933dc.zip
doc: fconv examples.
* txr.1: New examples for awk macro fconv.
-rw-r--r--txr.125
1 files changed, 25 insertions, 0 deletions
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