I have a script with two codes to pull the sum of data of a given file and print to another file and a second pulls the total number of missing data points to another file. Finally the two output files are placed together in to a third file. All three codes work when run alone. Due to the large number of files needing to have this done I was attempting to automate in a single script file. Running bash shell. The Colavg.sh file has been execute permissions. When I attempt to run this as a single script I get the following error:
awk: cmd. line:1: ./Colavg.sh
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: ./Colavg.sh
awk: cmd. line:1: ^ unterminated regexp
#!/bin/awk
awk -F ',' 'NF==4{count++} END {print "missing: "count}' County029-CO-0023-T0000JD.out > avg.out;
awk -F ',' '$4==-999{c999++}; END{print "missing: "c999}' County029-CO-0023-T0000JD.out > avg1.out;
cat avg1.out avg.out >> County029-CO-0023-T0000JD-avg.out
#!/bin/sh
or#!/bin/bash