Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

looping in a bash script

Avatar of sebastizz
sebastizz asked on
Mac OS XShell Scripting
6 Comments1 Solution303 ViewsLast Modified:
I have been doing this for hours and I have just given up:...

The task: loop through a folder of files and perform 6 scripts on each file to run as one shell script

Each time a file is processed by one script it gets put in another folder. The intention is to pass the resulting file name to the next script. I dont want to keep the folder path and the original .txt or whatever just the filename and the new file extension. Can anyone help?

The scripts are as follows (on a mac as a shell script)

for each file as $file

$ gzcat $file.fq.gz | ./reformat_sequence_data.rb > ./reformatsequence/$file.txt

$ python qualityMask.py ./reformatsequence/$file.txt  ./qualitymask/$file.seq 20 1

$ ./unique_seq_counts.rb ./qualitymask/$file.seq > ./uniquecounts/$file.counts.txt

$ cut -f1 ./uniquecounts/$file.counts.txt > ./uniqueseq/$file.uniq.seq

$ ./bowtie-1.1.0/bowtie -r -m1 -v1  ./bowtie-1.1.0/indexes/hg19 ./uniqueseq/$file.uniq.seq > ./alignedunique/$file.bowtie.txt
Avatar of omarfarid
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers