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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comma and number

Status
Not open for further replies.

sabetik

IS-IT--Management
Nov 16, 2003
80
GU
I have the following output:
A00D4-N8936 BRAKE PACKAGING 1,259.94

My out out will be 15% of 1259.94
part-no. dessc amount*15%
when I have a amount with thousand (1,259.94) system only take the 1. here the program:

f1 = substr($0,4,17)
f2 = substr($0,23,20)

f3 = substr($0,45,10)
f3 = f3 + 0
f3 = f3 * 1.15
printf ("%-15s %-19s %10s\n",f1,f2,f3 ) > "outdata.txt"

Please help.
 
You need to remove any non-numeric characters, e.g...
Code:
:
   f3 = substr($0,45,10)
   [b]gsub(/[^0-9\.\-]/, "", f3)[/b]
   f3 = f3 * 1.15
:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top