I am trying to concatenate some 100 files from one directory and writing them into another directory and I want to automate this as follows:
But cat statement inside for loop does not work. But echo statement inside the for loop shows the correct path to the files? Why is it not concatenating files? I am new to shell scripting. Thanks in advance.
But cat statement inside for loop does not work. But echo statement inside the for loop shows the correct path to the files? Why is it not concatenating files? I am new to shell scripting. Thanks in advance.
Code:
if [ $# -lt 4 ]
then
echo Usage: $0 Directory st end lib_name
exit 1
fi
echo $1 $2 $3 $4
mkdir test
dir=$1
IN=$1
IFS="/"
bar=( $IN )
#echo ${bar[3]}
Name=${bar[3]}
#contatenating test files
for(( i = $2; i <= $3; i++ ))
do
echo "$dir/Data/Int/Calls/s_${i}_1_0*qtest.txt"
cat $dir/Data/Int/Calls/s_${i}_1_0*test.txt > $4/$Name.txt
done
Comment