#!/bin/bash

#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.8g2
#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.9g2
#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.10g2
#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.11g2
#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.12g2
#    wget http://walrus.wr.usgs.gov/infobank/v/v181sc/samp/v-1-81-sc.core.gravitycore.13g2

for file in v-1-81-sc.core.gravitycore.*g2
do
    echo $file
    lat=`grep Latitude $file | awk '{print $3}'`
    lon=`grep Longitude $file | awk '{print $3}'`
    id=`grep 'Sample ID' $file | awk '{print $4}'`
    depth=-`grep 'Water Depth' $file | awk '{print $4}'`
    length=`grep 'Core Length' $file | awk '{print $4}'`
    echo "$lat $lon $depth \"${id}_${length}cm\"" >> v-1-81-sc.corelocations
done
