function print_str() {
cat<<EOF
this will be input to the file where STDOUT
EOF
}
cur_dir=$(PWD= /bin/pwd)
dirs=$(find $cur_dir -name plf -type d -print)
for dir in $dirs
do
plf_files=$(ls $dir | grep .*.plf.tmp$)
for file in $plf_files
do
mv $dir/$file $dir/${file%.tmp}
touch $dir/$file
exec 5>&1
exec 1>$dir/$file
print_str
exec 1>&5
done
done