#!/usr/bin/perl -w
use strict;
my(@lines,@t,$ra1,$dec1,$flux);


# read file

chomp(@lines=`cat ./nvss_full.dat`);

foreach (@lines) { 
	@t=split(/ +/,trim($_));

	$ra1 =join('',$t[0],"h",$t[1],"m",$t[2],"s" );
	$dec1=join('',$t[3],"d",$t[4],"'",$t[5]);
	$flux=$t[6];

	$ra1=ratorad($ra1);
	$dec1=dectorad($dec1);
	if($flux >= 50.0) { 
	printf("$flux %8.5f %8.5f $t[0] $t[1] $t[2] $t[3] $t[4] $t[5]\n",$ra1,$dec1);
	}
} 

sub ratorad{
	use strict;
	my($ra)=@_;
	my(@t)=split(/([hms])/,$ra);
	my($deg)=$t[0]*3600.0+$t[2]*60.0+$t[4];
	$deg=$deg/240.0;
	my($rad)=$deg/57.29577951308232;
	return($rad);
	}

sub dectorad{
	use strict;
        my($dec)=@_;
        my($deg,$rad,$sign,@t);
        @t=split(//,$dec);
        $sign="+";
        if($t[0] eq "-") { $sign="-";}
        @t=split(/([d'"])/,$dec);
        if($sign eq "+"){$deg=$t[0]+$t[2]/60.0+$t[4]/3600;}
        if($sign eq "-"){$deg=$t[0]-$t[2]/60.0-$t[4]/3600;}
        $rad=$deg/57.29577951308232;
        return($rad);
        }

sub  trim{
	use strict;
	my $s = shift;
	$s =~ s/^\s+|\s+$//g;
	return($s);
	}

