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
This commit is contained in:
Fernando Apesteguía 2020-06-18 08:26:26 +00:00
parent c794cdc0a2
commit 43ad0e153d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=362298

View file

@ -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