So I am very new to unix coding and I have a fairly simple task that I just can't seem to figure out.
I have a folder on my desktop with multiple .fq
files ( Desktop/btindex
), and I am looking for a way to iterate over just those files in a shell script, and call commands on them. I just can't seem to find the right syntax to do this.
Is it best to write this script in an editor like vim from the console? Or is it better to just write it all out in the console itself?
Edit: I am working in the directory Desktop/bwaout, so my code:
for file in '../btindex/*.fq';
do
echo $file
done
seems to print...
../btindex/X.fq
How do I just get the .fq to print?
Use a for
loop as shown below:
for file in /some/path/*.fq
do
echo "Processing file: $file"
# other commands here
done
for myfile in *.fq ; do command "$myfile" ; another_command "$myfile" ; done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.