I am annotating some .txt files by Annovar software by this code

nnovar]$ module load annovar/2016Feb01

[cyan01 annovar]$ table_annovar.pl 

But I really got confused to do that by awk for all of my files in the path; Can somebody help me?

Many thanks


I found this but not working

module load annovar/20

for file in *.vcf; do
    table_annovar.pl example/a.txt humandb/ -buildver hg19 -out file -remove -protocol refGene,cytoBand,exac03,avsnp147,dbnsfp30a -operation gx,r,f,f,f "$f" > "${f%.*}.txt"
  • $\begingroup$ What do you mean by "not working"? What is the error message you are getting? $\endgroup$
    – haci
    Commented Nov 19, 2019 at 11:58

2 Answers 2


$f in your command is not pointing anywhere since your for loop was defined as for file in *.vcf;. You should use $file instead of $f.


First of all, please copy and paste the error messages you are getting when seeking answers from the community, most of the time the error messages are clear enough to point to the right direction.

In you case, the problem is that you are trying to use a variable that you did not declare in the first place. It is explained above in my original answer but here I go again:

With this bit for file in *.vcf;, you are creating a variable file that you will using throughout the iteration. But then within the iteration, the next line (... -operation gx,r,f,f,f "$f" > ..., you try to use another variable file, that has not been declared yet (as far as I can see from your code bit).


The basic outline for loops is

for sample in *; do mycommand "$sample" ; done

You might need some way of incorporating the name of $sample into the output file name, so you don't keep overwriting the same output file over and over again (or do mkdir with each sample name and write everything for each sample in its own folder).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.