From 1ab994bbf682b08a9c258529973f3502bd33ecbe Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 26 Jun 2020 21:50:07 +0000 Subject: Document that FS is applied at the time the input line is read. Previously, our awk suffered from a bug where FS was applied too late. This fix has the potential to cause problems for awk scripts written to the old (buggy) behavior. The current behavior is consistent with other awk implementations such as mawk and gawk. --- usr.bin/awk/awk.1 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'usr.bin/awk/awk.1') diff --git a/usr.bin/awk/awk.1 b/usr.bin/awk/awk.1 index 12e752b70b6..ee2f8dc8ca8 100644 --- a/usr.bin/awk/awk.1 +++ b/usr.bin/awk/awk.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: awk.1,v 1.53 2020/06/17 15:34:11 tim Exp $ +.\" $OpenBSD: awk.1,v 1.54 2020/06/26 21:50:06 millert Exp $ .\" .\" Copyright (C) Lucent Technologies 1997 .\" All Rights Reserved @@ -22,7 +22,7 @@ .\" ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF .\" THIS SOFTWARE. .\" -.Dd $Mdocdate: June 17 2020 $ +.Dd $Mdocdate: June 26 2020 $ .Dt AWK 1 .Os .Sh NAME @@ -140,6 +140,16 @@ refers to the entire line. If .Va FS is null, the input line is split into one field per character. +Lines are split into fields using the value of +.Va FS +at the time the line is read. +Because of this, +.Va FS +is usually set via the +.Fl F +option or inside of a +.Ic BEGIN +block. .Pp Normally, any number of blanks separate fields. In order to set the field separator to a single blank, use the -- cgit v1.2.3