Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/historical/nawk/bin awk(1): Factor out output redir...



details:   https://anonhg.NetBSD.org/src/rev/063b9d0436e0
branches:  trunk
changeset: 368324:063b9d0436e0
user:      uwe <uwe%NetBSD.org@localhost>
date:      Tue Jul 05 15:56:42 2022 +0000

description:
awk(1): Factor out output redirection for print and printf.

This makes the description way less cluttered and explicitly shows
"| expr" (that was mentioned, but not written out) and ">> file" (that
was not even mentioned at all).  Adapted from the POSIX wording, but
doesn't bring over all the detailed verbiage.

diffstat:

 external/historical/nawk/bin/awk.1 |  40 ++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 18 deletions(-)

diffs (64 lines):

diff -r 3c5f0f1c9b23 -r 063b9d0436e0 external/historical/nawk/bin/awk.1
--- a/external/historical/nawk/bin/awk.1        Tue Jul 05 15:37:13 2022 +0000
+++ b/external/historical/nawk/bin/awk.1        Tue Jul 05 15:56:42 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: awk.1,v 1.23 2022/07/05 15:35:53 uwe Exp $
+.\"    $NetBSD: awk.1,v 1.24 2022/07/05 15:56:42 uwe Exp $
 .\"
 .\" Copyright (C) Lucent Technologies 1997
 .\" All Rights Reserved
@@ -313,33 +313,37 @@
 .Ic getline
 returns the next line of output from
 .Ar expr .
-.It Ic print Oo Ar expr-list Oc Op Ic > Ar file
-The
-.Ic print
-statement prints its arguments on the standard output (or to a file
-if
-.Ic \*[Gt] file
-or to a pipe if
-.Ic \&| Ar expr
-is present),
-separated by the current output field separator
+.It Ic print Oo Ar expr-list Oc Op Ar redirection
+Print arguments separated by the current output field separator
 .Va OFS ,
 and terminated by the
 output record separator
 .Va ORS .
+.It Ic printf Ar format\| Ns Oo Ic \&, Ar expr-list Oc Op Ar redirection
+Format and print its expression list according to
+.Ar format .
+See
+.Xr printf 3
+for list of supported formats and their meaning.
+.El
+.Pp
+Both
+.Ic print
+and
+.Ic printf
+statements write to standard output by default.
+The output is written to the file or pipe specified by
+.Ar redirection
+if one is supplied, as follows:
+.Ic \&> Ar file , ""
+.Ic \&>> Ar file , No or
+.Ic \&| Ar expr .
 Both
 .Ar file
 and
 .Ar expr
 may be literal names or parenthesized expressions; identical string values in
 different statements denote the same open file.
-.It Ic printf Ar format\| Ns Oo Ic \&, Ar expr-list Oc Op Ic \*[Gt] Ar file
-Format and print its expression list according to
-.Ar format .
-See
-.Xr printf 3
-for list of supported formats and their meaning.
-.El
 .Ss Mathematical and Numeric Functions
 AWK has the following mathematical and numerical functions built-in:
 .Bl -tag -width Fn



Home | Main Index | Thread Index | Old Index