From 848e713f8fd84af478d9d2c31661b50081ee136b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 17 Sep 2016 14:31:58 -0700 Subject: New awk variable: krs. * share/txr/stdlib/awk.tl (sys:awk-state): New slot, krs. (sys:awk-state loop): Use record-adapter if krs is true, even if the default fs is in effect. Pass value of krs to record-adapter function. (sys:awk-let): Provide krs "awk variable" symbol macro. * txr.1: Documented krs. Clarified semantics of rs being those of both separation and termination. --- txr.1 | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'txr.1') diff --git a/txr.1 b/txr.1 index 7e5ce1e7..f73c370c 100644 --- a/txr.1 +++ b/txr.1 @@ -37733,11 +37733,15 @@ instantiated by the .code record-adapter function. -The meaning of +The regular expression pattern stored in +.code rs +is used to matches substrings in the input which separate or terminate records. +Unless the +.code krs +variable is set true, the substrings which match .code rs -is that it matches substrings in the input which separate records. Records -consist of the non-matching extents between matches for -.codn rs . +are discarded and the records consist of the non-matching extents between +them. The initial value of .code rs @@ -37745,6 +37749,22 @@ is .strn "\en" : the newline character. This means that, by default, records are lines. +If a match for the record separator occurs at the end of the stream, +it is not considered to delimit an empty record, but acts as the +terminator for the previous record. + +.coNP Variable @ krs +.desc +The awk variable +.code krs +stands for "keep record separator". It is a Boolean variable, initialized to +.codn nil . + +If it is set to a true value, then the separating text matched +by the pattern in the +.code rs +variable is retained as part of the preceding record rather than removed. + .coNP Variable @ fs .desc The awk variable -- cgit v1.2.3