Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/seq seq(1): add more examples, improve wording



details:   https://anonhg.NetBSD.org/src/rev/1c798902f12f
branches:  trunk
changeset: 362470:1c798902f12f
user:      wiz <wiz%NetBSD.org@localhost>
date:      Mon Feb 28 13:49:50 2022 +0000

description:
seq(1): add more examples, improve wording

>From OpenBSD via jmc@OpenBSD

diffstat:

 usr.bin/seq/seq.1 |  48 ++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 10 deletions(-)

diffs (82 lines):

diff -r dfac097f225d -r 1c798902f12f usr.bin/seq/seq.1
--- a/usr.bin/seq/seq.1 Mon Feb 28 08:45:36 2022 +0000
+++ b/usr.bin/seq/seq.1 Mon Feb 28 13:49:50 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: seq.1,v 1.11 2021/11/01 21:28:03 andvar Exp $
+.\"    $NetBSD: seq.1,v 1.12 2022/02/28 13:49:50 wiz Exp $
 .\"
 .\" Copyright (c) 2005 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -45,12 +45,11 @@
 .Sh DESCRIPTION
 The
 .Nm
-utility prints a sequence of numbers, one per line
-.Pq default ,
+utility prints a sequence of numbers, one per line by default,
 from
 .Ar first
-.Pq default 1 ,
-to near
+.Pq default 1
+to as near
 .Ar last
 as possible, in increments of
 .Ar incr
@@ -131,22 +130,51 @@
 .Sh EXIT STATUS
 .Ex -std
 .Sh EXAMPLES
+Generate a sequence from 1 to 3 (inclusive) with a default increment of 1:
 .Bd -literal -offset indent
-# seq 1 3
+$ seq 1 3
 1
 2
 3
-
-# seq 3 1
+.Ed
+.Pp
+Generate a sequence from 3 to 1 (inclusive) with a default increment of -1:
+.Bd -literal -offset indent
+$ seq 3 1
 3
 2
 1
-
-# seq -w 0 .05 .1
+.Ed
+.Pp
+Generate a sequence from 0 to 0.1 (inclusive) with an increment of 0.05
+and padding with leading zeroes:
+.Bd -literal -offset indent
+$ seq -w 0 .05 .1
 0.00
 0.05
 0.10
 .Ed
+.Pp
+Generate a sequence from 1 to 3 (inclusive) with a default increment of 1,
+and a custom separator string:
+.Bd -literal -offset indent
+$ seq -s "," 1 3
+1,2,3
+.Ed
+.Pp
+Generate a sequence from 1 to 2 (inclusive) with an increment of 0.2 and
+print the results with two digits after the decimal point (using a
+.Xr printf 3
+style format):
+.Bd -literal -offset indent
+$ seq -f %.2f 1 0.2 2
+1.00
+1.20
+1.40
+1.60
+1.80
+2.00
+.Ed
 .Sh SEE ALSO
 .Xr jot 1 ,
 .Xr printf 1 ,



Home | Main Index | Thread Index | Old Index