1. 前期准备
-
数据下载
$ wget -c ftp://hgdownload.cse.ucsc.edu/goldenPath/sacCer3/bigZips/mrna.fa.gz $ wget -c ftp://hgdownload.cse.ucsc.edu/goldenPath/sacCer3/bigZips/mrna.fa.gz.md5
-
数据完整性校验
$ md5sum --check mrna.fa.gz.md5 mrna.fa.gz: OK
-
了解fasta格式,提取序列
$ gunzip -c mrna.fa.gz | grep -v "^>" > data.fa
2. 脚本编写
test.sh
#!/bin/bash
for i in {a..z}
do
grep -q $i data.fa;
if [ $? == 0 ]; then
n=`grep -o $i data.fa | wc -l`;
printf "$i\t$n\n";
fi
done
3. 脚本运行
$ bash test.sh
a 98378
b 1
c 59955
d 21
g 65147
n 866
r 1
s 2
t 89401
w 1
y 1