Skip to content

nl | Cheatsheet

Number lines and write files, writes each FILE to standard output, with line numbers added to some or all of the lines. If no input file (or '-' ) is given nl will read from standard input.

Use NUMBER columns for line numbers

seq 10 \
    |nl --number-width=5

Number separator

seq 10 \
    |nl --number-separator='> '

Example usage

find site/incoming/ \
    -type d \
    -iname *linux* \
        |grep -v '_' \
        |sort \
        |sed 's:.*/::' \
        |nl --number-width=4 --number-separator=") "