Maybe I have an answer here. However, to clarify:
I should have made it clearer that files named *F.dta need to be copied to a specific filename, always the same.
So a file originally named, say, "20071208134214F.dta" (note the date and time) would have to be copied to "AlwaysUseSameFileName_F.dta".
Similarly for the 'R' file.
There are
always matched pairs of *.dta files.
I have a C program which processes the data from the two resultant files, "AlwaysUseSameFileName_F.dta" and "AlwaysUseSameFileName_R.dta"
So My original (incorrect) code should have read:
Code:
for fileA in *F.dta AND fileB in *R.dta
do
cp -f $fileA /home/mystuff/AlwaysUseSameFileNameF.dta
cp -f $fileB /home/mystuff/AlwaysUseSameFileNameR.dta
cd /home/mystuff
./ProcessTheTwoSiblingDataFiles
cd /home/logfiles
# go round this loop until all pairs of *.dta files are processed
done
Thanks, guys. Will check out your idea(s) later (have vehicle problems,
sigh).
Thanks, Matthew. Thanks, Rupert. Works just great.
What I don't understand is
why it works.
For instance
Code:
d_file="${f_file%F.dta}D.dta"
if [ -a "$d_file" ]; then
has me totally bemused.
I can't see how the parameter from
$f_file is taken and converted into D.dta and hence into
$d_file. Is it an increment on
$f_file to find D.dta?
Whatever, it works