#!/bin/sh
#
# Scans ANSS formatted output and converts it to PDPC input.
# http://www.ncedc.org/anss/catalog-search.html
# Usage: "create_catalog_anss.sh < input > output"

awk '
{
   year  = 1.0 * substr($0,1,4)
   month = 1.0 * substr($0,6,2)
   day   = 1.0 * substr($0,9,2)

   lat = 1.0 * substr($0,24,8)
   lon = 1.0 * substr($0,33,9)

   mag = 1.0 * substr($0,51,4)
}
(lat!=0) && (lon!=0) {print year,month,day,lon,lat,mag}
'

