nl
nl [OPCIÓN]... [ARCHIVO]...
Numerar líneas de archivos
Options
--help-
Imprimir información de ayuda.
--body-numbering=<STYLE>,-b <STYLE>-
usar ESTILO para numerar líneas del cuerpo
--section-delimiter=<CC>,-d <CC>-
usar CC para separar páginas lógicas
--footer-numbering=<STYLE>,-f <STYLE>-
usar ESTILO para numerar líneas del pie
--header-numbering=<STYLE>,-h <STYLE>-
usar ESTILO para numerar líneas del encabezado
--line-increment=<NUMBER>,-i <NUMBER>-
incremento del número de línea en cada línea
--join-blank-lines=<NUMBER>,-l <NUMBER>-
grupo de NÚMERO líneas vacías contadas como una
--number-format=<FORMAT>,-n <FORMAT>-
insertar números de línea según FORMATO
--no-renumber,-p-
no reiniciar números de línea en páginas lógicas
--number-separator=<STRING>,-s <STRING>-
agregar CADENA después del número de línea (posible)
--starting-line-number=<NUMBER>,-v <NUMBER>-
primer número de línea en cada página lógica
--number-width=<NUMBER>,-w <NUMBER>-
usar NÚMERO columnas para números de línea
ESTILO es uno de:
- a numerar todas las líneas
- t numerar solo líneas no vacías
- n no numerar líneas
- pBRE numerar solo líneas que contengan una coincidencia para la expresión regular básica, BRE
FORMATO es uno de:
- ln justificado a la izquierda, sin ceros a la izquierda
- rn justificado a la derecha, sin ceros a la izquierda
- rz justificado a la derecha, con ceros a la izquierda
Examples
Number non-blank lines in a file:
nl {{path/to/file}}
Read from stdin:
{{command}} | nl -
Number [a]ll [b]ody lines including blank lines or do [n]ot number [b]ody lines:
nl -b {{a|n}} {{path/to/file}}
Number only the [b]ody lines that match a basic regex (BRE) [p]attern:
nl -b p'FooBar[0-9]' {{path/to/file}}
Use a specific [i]ncrement for line numbering:
nl -i {{increment}} {{path/to/file}}
Specify the line numbering format to [r]ight or [l]eft justified, keeping leading [z]eros or [n]ot:
nl -n {{rz|ln|rn}}
Specify the line numbering’s [w]idth (6 by default):
nl -w {{col_width}} {{path/to/file}}
Use a specific string to [s]eparate the line numbers from the lines (TAB by default):
nl -s {{separator}} {{path/to/file}}
The examples are provided by the tldr-pages project under the CC BY 4.0 License.
Please note that, as uutils is a work in progress, some examples might fail.