Use ARGCinstead;
BEGIN {
if(ARGC==1) {
print "<Gasp.sh> <inputfile>"
exit
}
calc = 0
}
Edit: Unfortunately, @shaikisiegal deleted his answer, so I will add this quote from the GNU awk documentation section. The built-in variables are here:
_ , awk . , awk , FILENAME "-". FILENAME , (. ). BEGIN FILENAME "", .
Unix awk FILENAME "-", . , .