View a file with line numbers

Contributor Icon Contributed by qmchenry Date Icon September 4, 2003  
Tag Icon Tagged: UNIX

Using the cat command in UNIX, a file can be displayed with the line number of each line preceding the line


cat -n filename

Previous recipe | Next recipe |
 
  • Anonymous
    pr -n
    will do the same thing, if one wants pretty-printed (line wrapped, with headers), say when dumping to a line printer.
blog comments powered by Disqus