I have several files and I only want to take specific columns from it. At the moment, I am using the following code:
$cut -f 1,2,5 AD0062-C.vcf > cutAD0062.txt
However, to speed up the process I was wondering if I could cut the same columns (fields 1,2,5) in multiple files and then print the output to several different files. I.e columns 1,2,5 of files AD0063-C.vcf, AD0064-C.vcf, AD0065-C.vcf should output results to separate files: cutAD0063.txt, cutAD0064.txt, cutAD0065.txt?
You can write a for...loop:
for i in AD*-C.vcf
do
cut -f 1,2,5 $i > cut${i%-C.vcf}.txt
done