#include <iostream>
#include <string>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <sstream>
using namespace std;
int main()
{
int name_num=0;
ifstream infile("name_protein.txt"); //输入文件
string line;
ostringstream filename; //用来存储名字
FILE *ofile;
while(getline(infile,line))
{
if(line[0]=='>')
{
name_num++;
filename<<name_num;
ofile=fopen(filename.str().c_str(),"w"); //打开文件 文件命名为1、2、3等
fprintf(ofile,"%s",line.c_str());
fprintf(ofile,"/n");
}
else
{
fprintf(ofile,"%s",line.c_str());
fclose(ofile);
filename.str("");
//free ofile;
}
}
free(ofile);
}
|
#!/bin/bash
#dys
for ((i=1;i<=11;i++))
do
../../prof ./$i fileRdb="$i.out" sec //输入文件为"$i" , 输出为:"$i.out"
done
|
整行替换: