awk '{print NR, $0}' file.txt

Category: Text Processing

awk '{print NR, $0}' file.txt

Print each line with its line number prepended

Prints each line prefixed with its line number by prepending NR to $0 (the whole line).
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.