logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

nl.1p (8738B)


  1. '\" et
  2. .TH NL "1P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. nl
  12. \(em line numbering filter
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. nl \fB[\fR-p\fB] [\fR-b \fItype\fB] [\fR-d \fIdelim\fB] [\fR-f \fItype\fB] [\fR-h \fItype\fB] [\fR-i \fIincr\fB] [\fR-l \fInum\fB]
  17. [\fR-n \fIformat\fB] [\fR-s \fIsep\fB] [\fR-v \fIstartnum\fB] [\fR-w \fIwidth\fB] [\fIfile\fB]\fR
  18. .fi
  19. .SH DESCRIPTION
  20. The
  21. .IR nl
  22. utility shall read lines from the named
  23. .IR file
  24. or the standard input if no
  25. .IR file
  26. is named and shall reproduce the lines to standard output. Lines shall
  27. be numbered on the left. Additional functionality may be provided in
  28. accordance with the command options in effect.
  29. .P
  30. The
  31. .IR nl
  32. utility views the text it reads in terms of logical pages. Line
  33. numbering shall be reset at the start of each logical page. A logical
  34. page consists of a header, a body, and a footer section. Empty sections
  35. are valid. Different line numbering options are independently available
  36. for header, body, and footer (for example, no numbering of header and
  37. footer lines while numbering blank lines only in the body).
  38. .P
  39. The starts of logical page sections shall be signaled by input lines
  40. containing nothing but the following delimiter characters:
  41. .TS
  42. center box tab(@);
  43. cB | cB
  44. lw(1i)f5 | lw(1i).
  45. Line@Start of
  46. _
  47. \e:\e:\e:@Header
  48. \e:\e:@Body
  49. \e:@Footer
  50. .TE
  51. .P
  52. Unless otherwise specified,
  53. .IR nl
  54. shall assume the text being read is in a single logical page body.
  55. .SH OPTIONS
  56. The
  57. .IR nl
  58. utility shall conform to the Base Definitions volume of POSIX.1\(hy2017,
  59. .IR "Section 12.2" ", " "Utility Syntax Guidelines".
  60. Only one file can be named.
  61. .P
  62. The following options shall be supported:
  63. .IP "\fB\-b\ \fItype\fR" 10
  64. Specify which logical page body lines shall be numbered. Recognized
  65. .IR types
  66. and their meaning are:
  67. .RS 10
  68. .IP "\fBa\fP" 8
  69. Number all lines.
  70. .IP "\fBt\fP" 8
  71. Number only non-empty lines.
  72. .IP "\fBn\fP" 8
  73. No line numbering.
  74. .IP "\fBp\fIstring\fR" 8
  75. Number only lines that contain the basic regular expression
  76. specified in
  77. .IR string .
  78. .P
  79. The default
  80. .IR type
  81. for logical page body shall be
  82. .BR t
  83. (text lines numbered).
  84. .RE
  85. .IP "\fB\-d\ \fIdelim\fR" 10
  86. Specify the delimiter characters that indicate the start of a logical
  87. page section. These can be changed from the default characters
  88. .BR \(dq\e:\(dq
  89. to two user-specified characters. If only one character is entered,
  90. the second character shall remain the default character
  91. .BR ':' .
  92. .IP "\fB\-f\ \fItype\fR" 10
  93. Specify the same as
  94. .BR b
  95. .IR type
  96. except for footer. The default for logical page footer shall be
  97. .BR n
  98. (no lines numbered).
  99. .IP "\fB\-h\ \fItype\fR" 10
  100. Specify the same as
  101. .BR b
  102. .IR type
  103. except for header. The default
  104. .IR type
  105. for logical page header shall be
  106. .BR n
  107. (no lines numbered).
  108. .IP "\fB\-i\ \fIincr\fR" 10
  109. Specify the increment value used to number logical page lines. The
  110. default shall be 1.
  111. .IP "\fB\-l\ \fInum\fR" 10
  112. Specify the number of blank lines to be considered as one. For
  113. example,
  114. .BR "\-l\ 2"
  115. results in only the second adjacent blank line being numbered (if the
  116. appropriate
  117. .BR "\-h\ a" ,
  118. .BR "\-b\ a" ,
  119. or
  120. .BR "\-f\ a"
  121. option is set). The default shall be 1.
  122. .IP "\fB\-n\ \fIformat\fR" 10
  123. Specify the line numbering format. Recognized values are:
  124. .BR ln ,
  125. left justified, leading zeros suppressed;
  126. .BR rn ,
  127. right justified, leading zeros suppressed;
  128. .BR rz ,
  129. right justified, leading zeros kept. The default
  130. .IR format
  131. shall be
  132. .BR rn
  133. (right justified).
  134. .IP "\fB\-p\fP" 10
  135. Specify that numbering should not be restarted at logical page
  136. delimiters.
  137. .IP "\fB\-s\ \fIsep\fR" 10
  138. Specify the characters used in separating the line number and the
  139. corresponding text line. The default
  140. .IR sep
  141. shall be a
  142. <tab>.
  143. .IP "\fB\-v\ \fIstartnum\fR" 10
  144. Specify the initial value used to number logical page lines. The
  145. default shall be 1.
  146. .IP "\fB\-w\ \fIwidth\fR" 10
  147. Specify the number of characters to be used for the line number. The
  148. default
  149. .IR width
  150. shall be 6.
  151. .SH OPERANDS
  152. The following operand shall be supported:
  153. .IP "\fIfile\fR" 10
  154. A pathname of a text file to be line-numbered.
  155. .SH STDIN
  156. The standard input shall be used if no
  157. .IR file
  158. operand is specified, and shall be used if the
  159. .IR file
  160. operand is
  161. .BR '\-'
  162. and the implementation treats the
  163. .BR '\-'
  164. as meaning standard input.
  165. Otherwise, the standard input shall not be used.
  166. See the INPUT FILES section.
  167. .SH "INPUT FILES"
  168. The input file shall be a text file.
  169. .SH "ENVIRONMENT VARIABLES"
  170. The following environment variables shall affect the execution of
  171. .IR nl :
  172. .IP "\fILANG\fP" 10
  173. Provide a default value for the internationalization variables that are
  174. unset or null. (See the Base Definitions volume of POSIX.1\(hy2017,
  175. .IR "Section 8.2" ", " "Internationalization Variables"
  176. for the precedence of internationalization variables used to determine
  177. the values of locale categories.)
  178. .IP "\fILC_ALL\fP" 10
  179. If set to a non-empty string value, override the values of all the
  180. other internationalization variables.
  181. .IP "\fILC_COLLATE\fP" 10
  182. .br
  183. Determine the locale for the behavior of ranges, equivalence classes,
  184. and multi-character collating elements within regular expressions.
  185. .IP "\fILC_CTYPE\fP" 10
  186. Determine the locale for the interpretation of sequences of bytes of
  187. text data as characters (for example, single-byte as opposed to
  188. multi-byte characters in arguments and input files), the behavior of
  189. character classes within regular expressions, and for deciding which
  190. characters are in character class
  191. .BR graph
  192. (for the
  193. .BR "\-b\ t" ,
  194. .BR "\-f\ t" ,
  195. and
  196. .BR "\-h\ t"
  197. options).
  198. .IP "\fILC_MESSAGES\fP" 10
  199. .br
  200. Determine the locale that should be used to affect the format and
  201. contents of diagnostic messages written to standard error.
  202. .IP "\fINLSPATH\fP" 10
  203. Determine the location of message catalogs for the processing of
  204. .IR LC_MESSAGES .
  205. .SH "ASYNCHRONOUS EVENTS"
  206. Default.
  207. .SH STDOUT
  208. The standard output shall be a text file in the following format:
  209. .sp
  210. .RS 4
  211. .nf
  212. "%s%s%s", <\fIline number\fR>, <\fIseparator\fR>, <\fIinput line\fR>
  213. .fi
  214. .P
  215. .RE
  216. .P
  217. where <\fIline\ number\fP> is one of the following numeric formats:
  218. .IP "\fR%6d\fP" 10
  219. When the
  220. .BR rn
  221. format is used (the default; see
  222. .BR \-n ).
  223. .IP "\fR%06d\fP" 10
  224. When the
  225. .BR rz
  226. format is used.
  227. .IP "\fR%\-6d\fP" 10
  228. When the
  229. .BR ln
  230. format is used.
  231. .IP <empty> 10
  232. When line numbers are suppressed for a portion of the page; the
  233. <\fIseparator\fP> is also suppressed.
  234. .P
  235. In the preceding list, the number 6 is the default width; the
  236. .BR \-w
  237. option can change this value.
  238. .SH STDERR
  239. The standard error shall be used only for diagnostic messages.
  240. .SH "OUTPUT FILES"
  241. None.
  242. .SH "EXTENDED DESCRIPTION"
  243. None.
  244. .SH "EXIT STATUS"
  245. The following exit values shall be returned:
  246. .IP "\00" 6
  247. Successful completion.
  248. .IP >0 6
  249. An error occurred.
  250. .SH "CONSEQUENCES OF ERRORS"
  251. Default.
  252. .LP
  253. .IR "The following sections are informative."
  254. .SH "APPLICATION USAGE"
  255. In using the
  256. .BR \-d
  257. .IR delim
  258. option, care should be taken to escape characters that have special
  259. meaning to the command interpreter.
  260. .SH EXAMPLES
  261. The command:
  262. .sp
  263. .RS 4
  264. .nf
  265. nl -v 10 -i 10 -d \e!+ file1
  266. .fi
  267. .P
  268. .RE
  269. .P
  270. numbers
  271. .IR file1
  272. starting at line number 10 with an increment of 10. The logical page
  273. delimiter is
  274. .BR \(dq!+\(dq .
  275. Note that the
  276. .BR '!'
  277. has to be escaped when using
  278. .IR csh
  279. as a command interpreter because of its history substitution syntax.
  280. For
  281. .IR ksh
  282. and
  283. .IR sh
  284. the escape is not necessary, but does not do any harm.
  285. .SH RATIONALE
  286. None.
  287. .SH "FUTURE DIRECTIONS"
  288. None.
  289. .SH "SEE ALSO"
  290. .IR "\fIpr\fR\^"
  291. .P
  292. The Base Definitions volume of POSIX.1\(hy2017,
  293. .IR "Chapter 8" ", " "Environment Variables",
  294. .IR "Section 12.2" ", " "Utility Syntax Guidelines"
  295. .\"
  296. .SH COPYRIGHT
  297. Portions of this text are reprinted and reproduced in electronic form
  298. from IEEE Std 1003.1-2017, Standard for Information Technology
  299. -- Portable Operating System Interface (POSIX), The Open Group Base
  300. Specifications Issue 7, 2018 Edition,
  301. Copyright (C) 2018 by the Institute of
  302. Electrical and Electronics Engineers, Inc and The Open Group.
  303. In the event of any discrepancy between this version and the original IEEE and
  304. The Open Group Standard, the original IEEE and The Open Group Standard
  305. is the referee document. The original Standard can be obtained online at
  306. http://www.opengroup.org/unix/online.html .
  307. .PP
  308. Any typographical or formatting errors that appear
  309. in this page are most likely
  310. to have been introduced during the conversion of the source files to
  311. man page format. To report such errors, see
  312. https://www.kernel.org/doc/man-pages/reporting_bugs.html .