summaryrefslogtreecommitdiffstats
path: root/txr.1
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
commita58577fba180a08ebc0fcf43be8a99996359966f (patch)
tree262e90a4ce637ae3f8a35e4412597cd30311c4e2 /txr.1
parentc5d3b7ca3f2ef8fcf47fc6427487ccf96f1998ce (diff)
downloadtxr-a58577fba180a08ebc0fcf43be8a99996359966f.tar.gz
txr-a58577fba180a08ebc0fcf43be8a99996359966f.tar.bz2
txr-a58577fba180a08ebc0fcf43be8a99996359966f.zip
doc: fconv examples.
* txr.1: New examples for awk macro fconv.
Diffstat (limited to 'txr.1')
-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