ra & dec conversion from hh:mm:ss to degrees
<p>I have a file that contains ra &amp; dec in hh:mm:ss format. 
Say the file name is "coord.txt" and it's content is :</p>

<blockquote>
  <p>06 40 34.8 10 04 22 
    06 41 11.6 10 02 24 
    06 40 50.9 10 01 43</p>
</blockquote>

<p>06 40 34.8 is the ra and 10 04 22 is the dec
How do I convert it to degrees with python or any other program.</p>

<pre><code>s = "06 40 34.8 10 04 22 06 41 11.6 10 02 24 06 40 50.9 10 01 43"
# or s = f.readline()
d = [float(i) for i in s.split()] 
# d = [6.0, 40.0, 34.8, 10.0, 4.0, 22.0, 6.0, 41.0, 11.6, 10.0, 2.0, 24.0, 6.0, 40.0, 50.9, 10.0, 1.0, 43.0]

d2 = [d[i:i+3] for i in range(0, len(d), 3)] 
# d2 = [[6.0, 40.0, 34.8], [10.0, 4.0, 22.0], [6.0, 41.0, 11.6], [10.0, 2.0, 24.0], [6.0, 40.0, 50.9], [10.0, 1.0, 43.0]]

d3 = [(s/3600 + m/60 + h) * 15 for h,m,s in d2]

d4 = [d3[i:i+2] for i in range(0, len(d3), 2)]

print d4
# [[100.145, 151.09166666666667], [100.29833333333333, 150.6], [100.21208333333334, 150.42916666666667]]
</code></pre>

python awk