title: create a excel file using shell script
body: <p>I have a bunch of text files in a directory and i need to read them and extract information and keep in an excel or text file</p>
  
  <p>name1_1.txt</p>
  
  <pre><code>count: 10
  totalcount: 30
  percentage:33
  total no of a's: 20
  total no of b's: 20
  etc...
  </code></pre>
  
  <p>name2_2.txt</p>
  
  <pre><code>count: 20
  totalcount: 40
  percentage:50
  total no of a's: 10
  total no of b's: 30
  etc...
  </code></pre>
  
  <p>etc...</p>
  
  <p>output</p>
  
  <pre><code>             name1        name2
   count        10           20
   totalcount   30           40
   percentage   33           50
  </code></pre>
  
  <p>I want the output to keep in file called(example.txt or .csv) in the same directory.
  can i get help in this?</p>
  
  <p>here what i tried in writing a shell script,but can't create tab separated and output to file what i needed</p>
  
  <pre><code> #$ -S /bin/bash
  
  
   for sample in *.txt; do
      header=$(echo ${sample} | awk '{sub(/_/," ")}1'| awk '{print $1}')
      echo -en $header"\t"
   done
   echo -e ' \t '
   echo "count"
   for sample in *.txt; do
      grep "count:" $sample | awk -F: $'\t''{print $2}'
   done
   echo "totalcount"
   for sample in *.txt; do
      grep "totalcount:" $sample | awk -F: $'\t''{print $2}'
   done
   echo "percentage"
   for sample in *.txt; do
      grep "percentage:" $sample | awk -F: $'\t''{print $2}'
   done
  </code></pre>