Article 5CRTC [SOLVED] Remove all decimals from output

[SOLVED] Remove all decimals from output

by
Bartonsen
from LinuxQuestions.org on (#5CRTC)
I have a file looking like this:
Code:John 465 168 14883 6113 418 0 250 0 348 0 250 0
Elsa 560 619 749 900 560 800 480 909 240 660 730 0
Lisa 600 2739 4009 4016 1980 2460 1950 2688 2180 1890 900 400
Fred 0 1267 632 305 1932 1284 305 464 385 721 445 0I want to divide all numbers by "9.75", and only keep the integer numbers (ie no decimals)

Code:awk -v c=9.75 '{ for (i = 2; i <= NF; ++i) $i /= c; print }' OFS='\t' file1Produces this output:
Code:John 47.6923 17.2308 1526.46 626.974 42.8718 0 25.641 0 35.6923 0 25.641 0
Elsa 57.4359 63.4872 76.8205 92.3077 57.4359 82.0513 49.2308 93.2308 24.6154 67.6923 74.8718 0
Lisa 61.5385 280.923 411.179 411.897 203.077 252.308 200 275.692 223.59 193.846 92.3077 41.0256
Fred 0 129.949 64.8205 31.2821 198.154 131.692 31.2821 47.5897 39.4872 73.9487 45.641 0How can I get this output?
Here I have just removed the decimals. Round-up to nearest integer would ofcourse be preferred.
Code:John 47 17 1526 626 42 0 25 0 35 0 25 0
Elsa 57 63 76 92 57 82 49 93 24 67 74 0
Lisa 61 280 411 411 203 252 200 275 223 193 92 41
Fred 0 129 64 31 198 131 31 47 39 73 45 0latest?d=yIl2AUoC8zA latest?i=SuC43lYqdt0:b5gPqiarpBM:F7zBnMy latest?i=SuC43lYqdt0:b5gPqiarpBM:V_sGLiP latest?d=qj6IDK7rITs latest?i=SuC43lYqdt0:b5gPqiarpBM:gIN9vFwSuC43lYqdt0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments