Hello, I am on an Ubuntu 12 system.
I am trying to write a bash loop to run
for 184 files.
I have 184 files in two directories with identical file names (/data/rad1 and /data/rad2). I want to append each of the like named fastq files into a single like named file into a third directory /data/rad3.
I am just learning and have come up with:
which is not working. Any advice for a beginner?
I am trying to write a bash loop to run
Code:
cat /data/rad1/ang_TP30124.fastq /data/rad2/ang_TP30124.fastq > /data/rad3/ang_TP30124.fastq
I have 184 files in two directories with identical file names (/data/rad1 and /data/rad2). I want to append each of the like named fastq files into a single like named file into a third directory /data/rad3.
I am just learning and have come up with:
Code:
topdir=/data/rad3
dir1=/data/rad1
dir2=/data/rad1
for f in $topdir/$dir1/*.fastq
do
outf=$topdir/`basename $f .fastq`
cp $f $outf
cat $topdir/$dir2/`basename $f` >> $outf
done
As you suggested, I didn't need the 'cp' command.
Comment