Erroneous file concatenation.

I have more than one files in a directory , namely
GLOW_OUT.txt
FIELD_OUT.txt
BASE_OUT.txt
...
SHOW_OUT.txt

What I wanted to do is to

I am working in Korn Shell

What I did was :

for file in <directory_name>/*.* ;do
 cat $file | grep -v '^$' >> temp_file 
 rm $file
done

The files get deleted BUT THE temp_file DOES NOT CONTAIN DATA FROM THE CONSTITUENT FILES.

Can any one please help me on this ?

Thanks
Kumarjit.

In which directory were you when you executed your for loop?

Rather too busy but like the man said, maybe the relative paths were bogus:

fl=$( find <directory_name>/*.* -type f )
if [ "$fl" != "" ]
 then
  grep -v '^$' $fl > temp_file
  rm $fl
 fi

I cannot find something wrong in the original post!

*.* only matches file names with a . , so cannot match temp_file ,
and one can even improve efficiency:

for file in <directory_name>/*.* ;do
 cat "$file"
 rm -f "$file"
done | grep -v '^$' > temp_file

(The | grep ... discards empty lines.)

That is why I asked where was (dir.) when the script is executed, IMHO only obvious reason I see is No write privilege where he is...

Well, we are overdue for some feedback before we talk into the void any more!

@vbe and DGPickett -
I am executing the script from a directory which is different than the <directory_name> .

One more thing :
The code actually written was :

for file in <directory_name>/*.* ;do
 cat $file | grep -v '^$' >> <directory_name>/temp_file 
 rm $file
done

Maybe your temp_file cannot grow because the file systm if full? It looks fine to me, not optiimal, but functional. There should be data in there, or errors, if there is data in the files. An strace/truss/tusc will show exactly what is happening, epecially since it is easy to set up a one line one file case.