The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 07-01-2009
durden_tyler's Avatar
durden_tyler durden_tyler is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 548
Quote:
Originally Posted by barrypitts View Post
...
I would like toprint all the columns but convert the first two columns to decimals e.g. 8.05370960E+05 to 805370.960
...
If losing the blank space formatting is ok with you, then one option could be:


Code:
$
$ awk '{printf("%.3f %.3f %s %s %s %s %s %s %s %s %s\n",$1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11)}' data.txt
805475.136 969428.147 1 14 2968.00 3419.00 59.00 59 3.4028235E+38 2 w99-100
805464.719 969435.064 1 14 2968.03 3418.50 60.00 60 3.4028235E+38 2 w99-100
805454.301 969441.981 1 14 2968.05 3418.00 61.00 61 3.4028235E+38 2 w99-100
805443.884 969448.898 1 14 2968.08 3417.50 62.00 62 3.4028235E+38 2 w99-100
805433.466 969455.815 1 14 2968.11 3417.00 63.00 63 3.4028235E+38 2 w99-100
805423.048 969462.733 1 14 2968.14 3416.50 64.00 64 3.4028235E+38 2 w99-100
805412.631 969469.650 1 14 2968.16 3416.00 65.00 65 3.4028235E+38 2 w99-100
805402.213 969476.567 1 14 2968.19 3415.50 66.00 66 3.4028235E+38 2 w99-100
805391.795 969483.484 1 14 2968.22 3415.00 67.00 67 3.4028235E+38 2 w99-100
805381.378 969490.401 1 14 2968.24 3414.50 68.00 68 3.4028235E+38 2 w99-100
805370.960 969497.318 1 14 2968.27 3414.00 69.00 69 3.4028235E+38 2 w99-100
$
$

tyler_durden