Man*_*uel 2 scripting shell-script files
我想将以下命令应用于当前目录中的所有文件
clustalw -align -infile=*here goes the input filename* -outfile=*here goes the output filename*
Run Code Online (Sandbox Code Playgroud)
我还希望输出文件名与输入加上“.aln”相同。例如:
clustalw -align -infile=nexus0000.fna -outfile=nexus000.fna.aln
Run Code Online (Sandbox Code Playgroud)
谢谢您的帮助!
您可以按文件扩展名使用 for 循环和通配符:
for file in *.fna; do
clustalw -align -infile="$file" -outfile="$file.aln"
done
Run Code Online (Sandbox Code Playgroud)
如果要使用单个命令,可以使用find:
find . -maxdepth 1 -type f -iname "*.fna" -exec clustalw -infile {} -outfile {}.aln \;
Run Code Online (Sandbox Code Playgroud)