Michele Vallisneri's vallis.org

A simple awk line will add line numbers of prescribed field length to any file:

awk '{printf "\%3d \%s\n", NR, $0}' < myfile.txt

Use '\%.3d' to zero-pad the line numbers.

Apr 06, 2005

linenumbers (/progtricks)
2005-04-06, 19:38 [edit]


  Login:   Password:   [rss] [cc] [w3] [css]

© M. Vallisneri 2012 — last modified on 2010/01/29

Tantum in modicis, quantum in maximis