If you want a file with line
numbers (say for printing).
You can use the "nl" command
in linux.
$ nl file.c > file.c.num
See man for more options.
Normally nl gives line numbers
only for non blank lines.
To force it to give it to all lines
use -ba option:
$ nl -ba file.c >file.c.all_num
NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
production.