Awk sexigesimal to decimal

Ages ago I put on here some awk scripts to convert between decimal numbers and sexigesimal (i.e. very useful with astronomical catalogues) and I think I’ve also gone the other way… anyway here is an updated and a more useful bash script todo this, still using awk at the heart of it (this goes from sexigesimal to decimal):

#!/bin/bash
filein=$1
fileout=$2
cat $filein | awk ‘{if ($4>= 0) {h=($1*15)+($2/60)*15+($3/3600)*15; h2=$4+($5/60)+($6/3600); print h,h2,$7,$8,$9}; if ($4 $fileout

put this in whateveryoulike.sh and there you go.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: