From owner-dev-commits-src-all@freebsd.org Tue Jul 20 04:33:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 228AF664A8D; Tue, 20 Jul 2021 04:33:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GTQp507Cbz3DCb; Tue, 20 Jul 2021 04:33:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0C6A2437C; Tue, 20 Jul 2021 04:33:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16K4Xm1C022075; Tue, 20 Jul 2021 04:33:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16K4XmJr022074; Tue, 20 Jul 2021 04:33:48 GMT (envelope-from git) Date: Tue, 20 Jul 2021 04:33:48 GMT Message-Id: <202107200433.16K4XmJr022074@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: b891aedcdd2d - main - awk: Add more details top the FS variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b891aedcdd2d9a3e1530e45f6b785b768cccc466 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2021 04:33:49 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b891aedcdd2d9a3e1530e45f6b785b768cccc466 commit b891aedcdd2d9a3e1530e45f6b785b768cccc466 Author: Warner Losh AuthorDate: 2021-07-20 02:10:22 +0000 Commit: Warner Losh 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