On Fri, 26 Jun 2020 21:41:57 +0100, Stuart Henderson wrote:

> I don't know which is "correct" (the manpage isn't enlightening) but
> it was a bit unexpected so I wanted to at least draw attention to it
> in case it breaks somebody else's script.

The awk manual leaves a lot of things unspecified (buy the book ;-).
Does this addition help clear things up?

 - todd

Index: awk.1
===================================================================
RCS file: /cvs/src/usr.bin/awk/awk.1,v
retrieving revision 1.53
diff -u -p -u -r1.53 awk.1
--- awk.1       17 Jun 2020 15:34:11 -0000      1.53
+++ awk.1       26 Jun 2020 21:39:19 -0000
@@ -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

Reply via email to