aboutsummaryrefslogtreecommitdiffstats
path: root/doc/gawktexi.in
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-08-16 22:09:29 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-08-16 22:09:29 +0300
commit79b577d28d0921221726d881229b0364ef36eace (patch)
tree1d1eb3978963cd5b512d76d064f032fef5e195e2 /doc/gawktexi.in
parent1a9579b6c5722277b34802b7665f340b095a2e98 (diff)
parent44f0c70e04a1beef988cde4950aabe29139e789a (diff)
downloadegawk-79b577d28d0921221726d881229b0364ef36eace.tar.gz
egawk-79b577d28d0921221726d881229b0364ef36eace.tar.bz2
egawk-79b577d28d0921221726d881229b0364ef36eace.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r--doc/gawktexi.in22
1 files changed, 16 insertions, 6 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 5460dec3..652a38fa 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -6856,6 +6856,8 @@ shell, without any quotes, the @samp{\} gets deleted, so @command{awk}
figures that you really want your fields to be separated with TABs and
not @samp{t}s. Use @samp{-v FS="t"} or @samp{-F"[t]"} on the command line
if you really do want to separate your fields with @samp{t}s.
+Use @samp{-F '\t'} when not in compatibility mode to specify that TABs
+separate fields.
As an example, let's use an @command{awk} program file called @file{edu.awk}
that contains the pattern @code{/edu/} and the action @samp{print $1}:
@@ -7001,7 +7003,7 @@ root
@noindent
on an incorrect implementation of @command{awk}, while @command{gawk}
-prints something like:
+prints the full first line of the file, something like:
@example
root:nSijPlPhZZwgE:0:0:Root:/:
@@ -7101,7 +7103,7 @@ haven't been introduced yet.
BEGIN @{ FIELDWIDTHS = "9 6 10 6 7 7 35" @}
NR > 2 @{
idle = $4
- sub(/^ */, "", idle) # strip leading spaces
+ sub(/^ +/, "", idle) # strip leading spaces
if (idle == "")
idle = 0
if (idle ~ /:/) @{
@@ -7259,6 +7261,8 @@ if (substr($i, 1, 1) == "\"") @{
As with @code{FS}, the @code{IGNORECASE} variable (@pxref{User-modified})
affects field splitting with @code{FPAT}.
+Assigning a value to @code{FPAT} overrides field splitting
+with @code{FS} and with @code{FIELDWIDTHS}.
Similar to @code{FIELDWIDTHS}, the value of @code{PROCINFO["FS"]}
will be @code{"FPAT"} if content-based field splitting is being used.
@@ -7282,6 +7286,12 @@ FPAT = "([^,]*)|(\"[^\"]+\")"
Finally, the @code{patsplit()} function makes the same functionality
available for splitting regular strings (@pxref{String Functions}).
+To recap, @command{gawk} provides three independent methods
+to split input records into fields. @command{gawk} uses whichever
+mechanism was last chosen based on which of the three
+variables---@code{FS}, @code{FIELDWIDTHS}, and @code{FPAT}---was
+last assigned to.
+
@node Multiple Line
@section Multiple-Line Records
@@ -9274,7 +9284,7 @@ It then sends the list to the shell for execution.
@c ENDOFRANGE reout
@node Special Files
-@section Special @value{FFN} in @command{gawk}
+@section Special @value{FFN}s in @command{gawk}
@c STARTOFRANGE gfn
@cindex @command{gawk}, file names in
@@ -11268,7 +11278,7 @@ made of characters and is therefore also a string.
Thus, for example, the string constant @w{@code{" +3.14"}},
when it appears in program source code,
is a string---even though it looks numeric---and
-is @emph{never} treated as number for comparison
+is @emph{never} treated as a number for comparison
purposes.
In short, when one operand is a ``pure'' string, such as a string
@@ -29122,7 +29132,7 @@ to follow.
@quotation
Math class is tough!
-@author Late 1980's Barbie
+@author Teen Talk Barbie (July, 1992)
@end quotation
This @value{SECTION} provides a high level overview of the issues
@@ -29787,7 +29797,7 @@ values. The default for @command{awk} is to use double-precision
floating-point values.
@item
-In the 1980's, Barbie mistakenly said ``Math class is tough!''
+In the early 1990's, Barbie mistakenly said ``Math class is tough!''
While math isn't tough, floating-point arithmetic isn't the same
as pencil and paper math, and care must be taken: