From ede6b26ba25d7cd8a6269453486ae14a24a8ff6b Mon Sep 17 00:00:00 2001 From: fernape Date: Thu, 18 Jun 2020 08:26:26 +0000 Subject: [PATCH] nl(1): Add EXAMPLES section Add EXAMPLES section covering flags -b[ap] -n -i -s -v Approved by: bcr@ Differential Revision: Add EXAMPLES section covering flags -b[ap] -n -i -s -v --- usr.bin/nl/nl.1 | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/usr.bin/nl/nl.1 b/usr.bin/nl/nl.1 index cb67c046a118..1be5ed945c84 100644 --- a/usr.bin/nl/nl.1 +++ b/usr.bin/nl/nl.1 @@ -27,7 +27,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd May 4, 2014 +.Dd June 18, 2020 .Dt NL 1 .Os .Sh NAME @@ -230,6 +230,42 @@ as described in .Xr environ 7 . .Sh EXIT STATUS .Ex -std +.Sh EXAMPLES +Number all non-blank lines: +.Bd -literal -offset indent +$ echo -e "This is\\n\\n\\na simple text" | nl + 1 This is + + + 2 a simple text +.Ed +.Pp +Number all lines including blank ones, with right justified line numbers with +leading zeroes, starting at 2, with increment of 2 and a custom multi-character +separator: +.Bd -literal -offset indent +$ echo -e "This\\nis\\nan\\n\\n\\nexample" | nl -ba -n rz -i2 -s "->" -v2 +000002->This +000004->is +000006->an +000008-> +000010-> +000012->example +.Ed +.Pp +Number lines matching regular expression for an +.Em i +.No followed by either +.Em m +.No or +.Em n +.Bd -literal -offset indent +$ echo -e "This is\\na simple text\\nwith multiple\\nlines" | nl -bp'i[mn]' + This is + 1 a simple text + with multiple + 2 lines +.Ed .Sh SEE ALSO .Xr jot 1 , .Xr pr 1