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!

calculate lines

Status
Not open for further replies.

vti

Technical User
Feb 26, 2001
189
TR
I got a data like :

68240000.00
144290000.00
636070000.00
480000.00
26360000.00
50560000.00
20740000.00
17520000.00

How can i calculate the lines and get the total number of lines.?

thanks for any help

 
wc -l < filename will give you number of lines in a file
what do you mean by calculate ?
Dickie Bird (:)-)))
 
Sorry it's my fault ,i didn't mean number of lines.I need to calculate total value of lines.Like

68240000.00+144290000.00+636070000.00+480000.00+26360000.00+50560000.00+20740000.00+17520000.00 = ?


 
Try
awk 'BEGIN {SCNT=0}{SCNT+=$1}END{print SCNT}' infile


HTH Dickie Bird (:)-)))
 
it works well
thanks a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top