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

#set year = 2014

cat header_A_atmospheric.csv /users/rsg/observatory/buoy/pml/download/E1/*/????????/*A.txt | \
                             nawk 'BEGIN {FS=","}{if (NF&gt;=34) {print $0}} \
                             {if ($7 ~ /N/ &amp;&amp; (NF == 32)) {print $1","$2","$3","$4","$5","$6","$7","$8",,,,"$9","$10","$11","$12","$13","$14","$15","$16","$17","$18","$19","$20","$21","$22","$23","$24","$25","$26","$27","$28","$29","$30","$31","$32}} \
                             {if ($7 !~ /N/ &amp;&amp; (NF==32)){print $1","$2","$3","$4","$5","$6",,,"$7","$8","$9","$10","$11","$12","$13","$14","$15","$16","$17","$18","$19","$20","$21","$22","$23","$24","$25","$26","$27","$28",,"$29","$30","$31","$32}} \
                             {if ($7 ~ /N/ &amp;&amp; (NF == 31)){print $1","$2","$3","$4","$5","$6","$7","$8",,,,"$9","$10","$11","$12","$13","$14","$15","$16","$17","$18","$19","$20","$21","$22","$23","$24","$25","$26","$27",,"$28","$29","$30","$31}} \
                             {if (NF==29) {print $1","$2","$3","$4","$5","$6",,,,,,"$7","$8","$9","$10","$11","$12","$13","$14","$15","$16","$17","$18","$19","$20","$21","$22","$23","$24","$25",,"$26","$27","$28","$29}} \
                             {if (NF==28) {print $1","$2","$3","$4","$5","$6",,,,,,"$7","$8","$9","$10","$11","$12","$13","$14","$15","$16","$17","$18","$19","$20","$21","$22","$23","$24","$25",,,"$26","$27","$28}}' &gt; /users/rsg/observatory/buoy/pml/E1/final/E1_QC_buoy_2013-2014_A.csv

# concatenate the A, W, S files into a large CSV
#echo "Creating atmospheric file ..."
#cat header_A_atmospheric.csv /users/rsg/observatory/buoy/pml/download/E1/*/????????/*A.txt &gt; /users/rsg/observatory/buoy/pml/E1/final/E1_QC_buoy_2013-2014_A.csv
#echo "Creating waves file ..."
#cat header_W_waves.csv /users/rsg/observatory/buoy/pml/download/E1/*/????????/*W.txt | tr -d '\0\r' &gt; /users/rsg/observatory/buoy/pml/E1/final/E1_QC_buoy_2013-2014_W.csv
#echo "Creating in-water file ..."
#cat header_S_ocean.csv /users/rsg/observatory/buoy/pml/download/E1/*/????????/*S_L1.txt | tr -d '\0\r' &gt; /users/rsg/observatory/buoy/pml/E1/final/E1_QC_buoy_2013-2014_S.csv







exit(0)

</pre></body></html>