Did you use "grep -n '.' "?
grep -n '^' matches blank lines, too.
Doug
On Sat, Jul 23, 2022 at 2:51 PM Nelson H. F. Beebe <beebe(a)math.utah.edu> wrote:
Phil Budne <phil(a)ultimate.com> suggests "grep -n ." to print numbered
lines.
That mostly works, but loses blank lines, although they are properly
counted. I typically use
awk '{print FNR ":" $0}'
instead, which reports all lines, regardless of contents.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- University of Utah -
- Department of Mathematics, 110 LCB Internet e-mail: beebe(a)math.utah.edu -
- 155 S 1400 E RM 233 beebe(a)acm.org beebe(a)computer.org -
- Salt Lake City, UT 84112-0090, USA URL:
http://www.math.utah.edu/~beebe/ -
-------------------------------------------------------------------------------