nl
Number lines from files or stdin with configurable alignment, delimiter, and starting number. Outputs JSON or plain text for reference or debugging.
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 |
|---|---|---|---|
| raw | No | Write numbered text without a JSON envelope. | |
| paths | No | Files to number, or '-' for stdin. Defaults to stdin. | |
| start | No | Starting line number. | |
| width | No | Minimum number width. | |
| encoding | No | Text encoding (default: utf-8). Use 'auto' for BOM/autodetection. | utf-8 |
| increment | No | Line number increment. | |
| max_lines | No | Maximum JSON records to emit. | |
| separator | No | Separator between number and line. | |
| number_blank | No | Also number blank lines. | |
| show_encoding | No | Include encoding detection metadata in JSON result. | |
| encoding_errors | No | How to handle encoding errors (default: replace). | replace |
| encoding_profile | No | Locale-aware encoding fallback profile for auto-detection. |