<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/bin/csh

set years = (2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019)
set years = (2018 2019)

set outstem = /users/rsg/observatory/buoy/pml/L4/data
set finalstem = /users/rsg/observatory/buoy/pml/L4/final/annual


foreach year($years)
   echo $year
   mkdir -p $finalstem/{$year}

   echo " WQM"
   cat $outstem/{$year}/{$year}???/*WQM*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_WQM.txt
   echo " CDM"
   cat $outstem/{$year}/{$year}???/*CDM*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_CDM.txt

   # Change to use the GPS and Met (MPB) from the AMOS system rather than the AirMar
   echo " GPS &amp; MPB"
   if ($year &lt; 2014) then
      cat $outstem/{$year}/{$year}???/*GPS*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_GPS.txt
      cat $outstem/{$year}/{$year}???/*MPB*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_MPB.txt
   else
      cat $outstem/{$year}/{$year}???/*GPS_AMS*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_GPS.txt
      cat $outstem/{$year}/{$year}???/*MPB_AMS.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_MPB.txt
   endif
   #####
   
   echo " HSE"
   cat $outstem/{$year}/{$year}???/*HSE*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}'  | awk '/\./{if (NF==140) print $0}' &gt; $finalstem/{$year}/L4_HSE.txt
   cat $finalstem/L4_HSE_header.txt $finalstem/{$year}/L4_HSE.txt &gt; tmp.txt
   /bin/mv tmp.txt $finalstem/{$year}/L4_HSE.txt

   echo " NLF"
   cat $outstem/{$year}/{$year}???/*NLF*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_NLF.txt
   echo " PHL"
   cat $outstem/{$year}/{$year}???/*PHL*.txt | awk -v YYYY=$year '$0 ~ YYYY {print $0}' &gt; $finalstem/{$year}/L4_PHL.txt
   echo "============="
end


exit(0)
</pre></body></html>