文本查看、操作、统计命令
•head/tail cat/tac less/more
•wc sort uniq
•cut paste
cat
cat readme.txt
cat > file
cat file
zcat Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz|head
cat example.gtf|head
head example.gtf
head -n 2 example.gtf
head -2 example.gtf
less
less example.gtf
less -S example.gtf
less -SN example.gtf
zless
zless -SN Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz
练习6
1. 用 cat 命令新建一个文本文件,并查看打印到屏幕
2. 用 head/tail 命令查看 example.fq 的 前 后 12 行
3. 用 less 命令查看 example. gtf 或 Y 染色体 gff 文件
探索 S 、 N 参数
2. 用 head/tail 命令查看 example.fq 的 前 后 12 行
cat > catFile
cat catFile
pwd
ls
head example.fq
cat example.fq|head
cat example.fq|head -12
head -12 example.fq
3. 用 less 命令查看 example. gtf 或 Y 染色体 gff 文件
less -SN example.gtf
zless -SN
zless -SN Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz
cat > catFile
cat catFile
head -n 12 example.fq
tail -n 12 example.fq
less example.fq
less -S example.fq
less -N example.fq
less -SN example.fq
cat > filelyx
cat filelyx
cat example.fq| head
cat example.fq|head -12
head 12 example.fq
tail 12 example.fq
tail -12 example.fq
ls
wc -l example.fq
cat example.fq|wc -l
zcat
zcat Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz|cut -f 1
zcat Homo_sapiens.GRCh38.102.chromosome.Y.gff3.gz|cut -f 1,4-7,9|less -SN
cat
cat example.gtf|head
cat example.gtf|cut -f 4|head
cat example.gtf|cut -f 4|sort
cat example.gtf|cut -f 4|sort -n 正向
cat example.gtf|cut -f 4|sort -n -r 逆向
cat example.gtf|cut -f 1|sort -n -r
n v 不相容,不能同时 使用
cat example.gtf|cut -f 1|sort -n -r -v
cat example.gtf|cut -f 1|sort -v
cat example.gtf|head
cat example.gtf|sort -k 4 -n|less -SN
ls
cat example.gtf|cut -f 3|head
cat example.gtf|cut -f 3|head -20
cat example.gtf|cut -f 3|head -20|uniq
cat example.gtf|cut -f 3|head -20|uniq -c
cat example.gtf|cut -f 3|head -20|sort|uniq
cat example.gtf|cut -f 3|head -20|sort|uniq -c
文件拼接
cat >file1
cat >file2
cat file1 file2 > file3
cat file*
cat file3
paste 黏合
cat >fil4
paste fil4 readme.txt
paste fil4 readme.txt>file5
cat -a file
cat -a file5
seq 20
seq 20|paste - -
seq 20|paste - - - -
cat readme.txt
cat readme.txt|tr a-z A-Z
cat example.gtf|cut -f 3,4,5|head
cat example.gtf|cut -f 3,4,5|head|tr '\t' ';'
练习7
1. 用 less 查看 example.gtf ,然后管道符传递给 wc
2. 截取 example.gtf 第 9 列的内容
3. 在第 2 步的基础上截取分号分割的第 1 列
4. 在第 3 步的基础上排序、去重复并统计
5. 在第 4 步的基础上,将空格替换成制表符
cat example.gtf|wc -l
cat example.gtf|cut -f 9
cat example.gtf|cut -f 9|head -1
3. 在第 2 步的基础上截取分号分割的第 1 列
cat example.gtf|cut -f 9|cut -d ';' -f 1| head
4. 在第 3 步的基础上排序、去重复并统计
cat example.gtf|cut -f 9|cut -d ';' -f 1| sort|uniq|wc -l
cat example.gtf|cut -f 9|cut -d ';' -f 1| sort|uniq -c
5. 在第 4 步的基础上,将空格替换成制表符
cat example.gtf|cut -f 9|cut -d ';' -f 1| sort|uniq -c| tr ' ' ';'
cat example.gtf|cut -f 9|cut -d ';' -f 1| sort|uniq -c| tr -s ' ' ';'
cat example.gtf|cut -f 9|cut -d ';' -f 1| sort|uniq -c| tr -s ' ' ':'
cat /root/Data
cat example.gtf|wc
cat example.gtf|cut -f 9
cut -f 9 example.gtf|cut -f 1·-d ';'|sort -V|uniq -c
cat example.gtf|cut -f 9|cut -d ';' -f 1|sort -V|uniq -c
less -SN example.gtf|cut -f 9|cut -d ';' -f 1|sort -n|uniq -c