construct the filename to process??
I think what you're saying is that you want to read input.txt and use
that to:
a) from $3 derive the file names for subsequent processing, and
b) from $1 derive the string to search for in those subsequent files.
Since you refer to "cat" it seems like you're using UNIX so the simplest
solution would involve a mixture of awk and shell and so would be
somewhat OT here and more appropriate for comp.unix.shell but I'll risk
the flames this time in case I've misunderstood what you want:
I also think your final "substr()" whoud be substr($1,7,3) instead of
substr($1,7,10).
If all of the above is correct, one approach would be:
awk '{
qnt = substr($1,1,3) "-" substr($1,4,3) "-" substr($1,7,3)
gsub(/[^[:digit:]]/,"",$3)
print qnt, $3
}' input.txt |
while read qnt date
do
awk -v qnt="$qnt" '$0 ~ qnt{print FILENAME, qnt, $0}' OUT-*"$date"*
done
The above assumes you want to output the FILENAME, pattern searched for
and matching record. Adjust to suit.
Regards,
Ed.
|