nl
Add line numbers to text with configurable formatting, separator, and starting value. Output as JSON or plain text for debugging or reference.
Instructions
Number input lines with configurable formatting (alignment, delimiter, starting number). Read-only, no side effects. Returns JSON with numbered lines by default; use --raw for plain text. Use to add line numbers for reference or debugging. Not for simple concatenation — use 'cat'. See also 'cat'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| encoding | No | Text encoding. | utf-8 |
| increment | No | Line number increment. | |
| max_lines | No | Maximum JSON records to emit. | |
| number_blank | No | Also number blank lines. | |
| paths | No | Files to number, or '-' for stdin. Defaults to stdin. | |
| raw | No | Write numbered text without a JSON envelope. | |
| separator | No | Separator between number and line. | |
| start | No | Starting line number. | |
| width | No | Minimum number width. |