Reputation: 333
How to get from
42001 55836.5692 26.2335 28.3323 -0.5672 -2.0120 -7.6489
42002 55836.5827 26.2097 -14.4487 1.4356 -8.9812 -7.3800
this:
55836.5692 28.3323 1.000 1 1
55836.5963 -14.4487 1.000 1 1
?
I tried
awk '{printf "%s%9s\n", $2, $4" 1 1.000 1 1}' SPEFO.RVS > c_1.txt
But the spaces in file are wrong. Thank you
Upvotes: 1
Views: 39
Reputation: 2091
What about:
>> awk '{printf "%5.4f %15.4f %15.4f %15d %15d\n",$2,$4,1.000,1,1 }' SPEFO.RVS
55836.5692 28.3323 1.0000 1 1
55836.5827 -14.4487 1.0000 1 1
You can adjust formatting(e.g. %5.4f
, to %5.5f
to display 5
decimals or to %10.4f
to change position of the first word) according your needs.
Upvotes: 1