Workshop in Computational Bioskills - findOverlap.csh
#!/bin/csh

set motif = $1 # The DNA binding motif
set file = $2 # Promoters file 

if ($# != 2) then
  echo "Usage: secondScript.csh motif promoter-file"
  exit
endif

set n = `FASTA2line.pl $file | grep -v ORF | grep $motif | wc -l`

echo "There are $n promoters that contain the binding site $motif" 

echo "Their Nucleotide Composition is:"

FASTA2line.pl $file | grep -v ORF | grep $motif
  | cut -f 2 | fold -w 1 | 
    awk '{a[$1]++}END{for (i in a){print i"="a[i]}}'