In your latest script, change:
awk '
to:
awk -v DbDir="$offsetDbDir" '
and change:
while (1 == getline LINE < (find $offsetDbDir/ -type f -iname $swath"offb1-Sx.sps"))
to:
while (1 == get line LINE < (DbDir swath "offb1-Sx.sps"))
Your modification failed because:
- Shell variables aren't available inside
awk
scripts. - Shell command substitution doesn't work inside
awk
scripts. - In
awk
variable values are substituted by referencing their names; not by$
followed by their names as in the shell command language.
But this will only work if the filename you are reading matches the name specified exactly; it won't do a case-insensitive match unless the file resides on a filesystem that is case insensitive.