I have two files that I want to concatenate in one new file, but I want to do it by using a loop because I have different directories (a, b, c, g and z) with same 2 files. My loop is:
for i in a b c g z
do
(cd $i/; for i in File_*_best3.txt *_new3.txt; do cat $i > combined.txt; done)
done
But my result is a combined.txt
file exactly the same as my second input file, so my cat is not working properly. What is the issue here?
for $i in
and yourcat $i
are logically meaning different things. maybe used
for the directories, or something.