i'm wanting to assign the builtin variable FNR to a bash script variable, something like this, '$TOT_RECORDS = FNR'
awk '{ print NR-1 "\t" $0; }' $INPUT_FILE >$OUTPUT_FILE
and if i do this, i get each iteration number & i only want the total;
TOT_RECS=$(awk '{ print NR-1; }' $INPUT_FILE)
or this and i do get the total number, but how to assign it to global var?;
awk 'END {print NR}' $INPUT_FILE
via awk, i would like to read the input file, then output to new file with prefix line numbers and return total line numbers into a global script var. what am i missing here besides,
`wc -l` would work without all this hassle. ;-)