[TUHS] Line Numbers Before SysIII nl? BSD num?

Douglas McIlroy douglas.mcilroy at dartmouth.edu
Sun Jul 24 05:07:25 AEST 2022


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 at math.utah.edu> wrote:
>
> Phil Budne <phil at 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 at math.utah.edu  -
> - 155 S 1400 E RM 233                       beebe at acm.org  beebe at computer.org -
> - Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe/ -
> -------------------------------------------------------------------------------


More information about the TUHS mailing list