My Blog

Latest blog

Using an output of precedent command as an argument of following command

xargs is a great command that reads streams of data from standard input, then generates and executes command lines

  1. to print all vcf files in specific path
    echo `pwd` | cut -d'/' -f1-7 | xargs -I{} find {} -name '*.vcf'
  2. to know the number of lines/words/characters in specific file
    ls * | xargs -IFILE grep -vc '^#' FILE
  3. to count the number of all variants of vcf
    ls * | xargs -IFILE echo FILE | xargs grep -vc '^#' FILE