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>

<p>implementing @M.Danilchenko's logic in <code>awk</code></p>

<pre><code>$ awk '{for(i=1;i&lt;NF;i+=3) a[++c]=($i*15+($(i+1)+$(i+2)/60)/4);
        for(i=1;i&lt;c;i+=2) printf "(%.3f,%.3f) ", a[i],a[i+1]; 
        print ""}' file

(100.145,151.092) (100.298,150.600) (100.212,150.429)
</code></pre>

<p>where</p>

<pre><code>$ cat file
06 40 34.8 10 04 22 06 41 11.6 10 02 24 06 40 50.9 10 01 43
</code></pre>

python awk