Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2021 04:33:48 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b891aedcdd2d - main - awk: Add more details top the FS variable
Message-ID:  <202107200433.16K4XmJr022074@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=b891aedcdd2d9a3e1530e45f6b785b768cccc466

commit b891aedcdd2d9a3e1530e45f6b785b768cccc466
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2021-07-20 02:10:22 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2021-07-20 04:33:26 +0000

    awk: Add more details top the FS variable
    
    The current description of the FS is true, but only part of the
    truth. Add information about single characters and note that FS="" is
    undefined by the standard, though the two other awk implenetations (mawk
    and gawk) also have this interpretation.
    
    PR:             226112
    Sponsored by:   Netflix
---
 usr.bin/awk/awk.1 | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/usr.bin/awk/awk.1 b/usr.bin/awk/awk.1
index 4be4b96cabce..b85efe9d87cd 100644
--- a/usr.bin/awk/awk.1
+++ b/usr.bin/awk/awk.1
@@ -131,8 +131,9 @@ and newlines are used as field separators
 This is convenient when working with multi-line records.
 .Pp
 An input line is normally made up of fields separated by whitespace,
-or by the regular expression
-.Va FS .
+or by the extended regular expression
+.Va FS
+as described below.
 The fields are denoted
 .Va $1 , $2 , ... ,
 while
@@ -141,6 +142,22 @@ refers to the entire line.
 If
 .Va FS
 is null, the input line is split into one field per character.
+While both gawk and mawk have the same behavior, it is unspecified in the
+.St -p1003.1-2008
+standard.
+If
+.Va FS
+is a single space, then leading and trailing blank and newline characters are
+skipped.
+Fields are delimited by one or more blank or newline characters.
+A blank character is a space or a tab.
+If
+.Va FS
+is a single character, other than space, fields are delimited by each single
+occurrence of that character.
+The
+.Va FS
+variable defaults to a single space.
 .Pp
 Normally, any number of blanks separate fields.
 In order to set the field separator to a single blank, use the



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107200433.16K4XmJr022074>