循环通过所有输入并创建不同的输出文件 [英] Looping through all the inputs and creating distinct output files

查看:235
本文介绍了循环通过所有输入并创建不同的输出文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 7上使用 cygwin 。我有一个文件夹有大约1200个相同类型的文件(没有子目录)。我试图通过文件夹,并对每个文件执行一定的操作(它的生物信息对齐)。这里是我使用的代码:

I am using cygwin on Windows 7. I have a folder with about 1200 files of the same type(There are no sub-directories). I am trying to go through the folder and perform a certain action(it's bioinformatic alignment) on each file. Here is the code that I am using:

$用于Project / genomes_0208 / *中的文件;
do ./bowtie-build $ file ../bowtie-0.12.7/indexes/abc;
done

./ bowtie 我想要执行的操作。现在,这会完成文件夹中所有文件的操作,但是在这种情况下,它仍然将输出文件保存在同一个文件 abc 中。

./bowtie - build is the operation that I want to perform. Now, this does complete the operation for all the files in the folder,but it keeps writing the ouput in the same file abc in this case.

所以最后我只有一个文件与最新的输出。如何创建1200个不同的文件,每个输入一个?无论我命名输出文件,它可以是任何东西,只要它们明显不同。

So in the end I have only 1 file with the latest output. How can I create 1200 different files , one for each of the input? It doesn't matter what I name the output files, it could be anything, as long as they are obviously different.

希望我成功解释问题,我非常感谢您的帮助!

Hope I explained the problem successfully, I'd appreciate any help with this!

推荐答案

如何:

./bowtie-build $file "${file}.out"

如果您的文件具有唯一的名称,则应该生成唯一的输出文件。

If your files had unique names to begin with this should also produce unique output files.

这篇关于循环通过所有输入并创建不同的输出文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆