I would like to improve my shell script skills. What I want to do is that I will copy all the files in a specific folder into other destination folder and then save them into one file by concatenating them.
Below is my simple code.
path=/Users/sclee/Dropbox/project/java/projects/WaferPointDraw/src/main/resources/pattern
dest=/Users/sclee/Dropbox/journal/clustering_ieee_semi_2020/data/small_datasets/noise200000other2000
output=large_datast_3.txt
mkdir -p $dest;
echo "$dest directory is created"
for i in find ${path} -iname '*.txt'
;
do
cp $i $dest;
done
echo "all the files is copied"
cat ${dest}/* > ${dest}/${output}
echo "created the combined file"
I can achieve my goals with above codes, but I would like to process all the logic in the for loop. As you can see, the cat
command is done apart from the for loop. I would like to process them in the for
loop for the simple code.
Any help will be appreciated.
Thanks.
for
– glenn jackman Sep 21 '20 at 12:53