# Expl: As long as in file1 (NR==FNR), write $2 into array A with $1 as ID. If reading file2 and if ID in array ($4 in A), write out desired fields + array element for ID
awk'NR==FNR{A[$1]=$2;next}
($4 in A){print $1, $3, substr(A[$4],3), ($3+2)/7+.05}'$DIR/timeline_template_order.dat$FILENAME | sort-nrk2,2 |\
($4 in A){print $1, $3, substr(A[$4],3), ($3+2)/7+.05}'"$DIR/timeline_template_order.dat""$FILENAME" | sort-nrk2,2 |\