Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line numbers on a file.

Status
Not open for further replies.

pjb

Programmer
May 1, 2001
148
US
I need to put line numbers on a file in the first 8 positions. What is a good way?
 
One way is to use awk
Code:
awk '{printf("%8d %s\n",NR,$0)}' infile > outfile
Hope this helps. CaKiwi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top