随笔分类 - linux shell
摘要:001、 [b20223040323@admin2 test]$ ls a.gff [b20223040323@admin2 test]$ cat a.gff region 1 pseudogene 2 transcript 3 exon 4 pseudogene 5 transcript 6 ex
阅读全文
摘要:001、 [root@PC1 test03]# ls a.fa [root@PC1 test03]# cat a.fa ## 测试序列 ATCGATGC [root@PC1 test03]# cat a.fa | tr "ATCG" "TAGC" ## 提取碱基序列的互补序列 TAGCTACG
阅读全文
摘要:001、 [root@PC1 test3]# ls a.txt [root@PC1 test3]# cat a.txt ## 测试数据 334 gene kkk yyy gene gene kkk gene gene mmmm [root@PC1 test3]# awk 'BEGIN{a="no"}
阅读全文
摘要:001、 [root@PC1 test3]# ls a.txt [root@PC1 test3]# cat a.txt ## 测试数据 3 5 44 agf gene 45 87 gene dfg iu gene 887 777 [root@PC1 test3]# sed '1,/gene/{/ge
阅读全文
摘要:001、 [root@PC1 test3]# ls a.txt b.txt [root@PC1 test3]# cat a.txt ## 测试数据 3 a 5 b b 4 7 [root@PC1 test3]# cat b.txt ## 测试数据 3 a 5 b 4 7 [root@PC1 test
阅读全文
摘要:001、 [root@PC1 test3]# ls file1.txt file2.txt [root@PC1 test3]# cat file1.txt 1 John 2 Mary 3 Tom [root@PC1 test3]# cat file2.txt 1 M 2 F 4 M [root@PC
阅读全文
摘要:001、输出匹配字符之后的若干行 a、 [root@PC1 test4]# ls a.txt [root@PC1 test4]# cat a.txt ## 测试数据 01 02 kk 03 04 05 06 07 kk 08 09 10 11 12 ## 输出匹配字符之后的3行 [root@PC1
阅读全文
摘要:001、 [root@PC1 test3]# ls test.txt [root@PC1 test3]# cat test.txt ## 测试数据 jjjj kkk gene jjj dddd yyy iiii ppp ffff 999 gene ttt eeee mmm aaaa nnn [roo
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@PC1 test]# sed 's/ /tag/2'
阅读全文
摘要:001、判断文件是否存在 (base) [root@PC1 test4]# ls a.txt dir01 (base) [root@PC1 test4]# if [ -e a.txt ]; then echo "exist"; fi ## 判断文件是否存在 exist (base) [root@PC
阅读全文
摘要:001、将所有的小写字母转换为大写 [root@PC1 test4]# ls a.txt [root@PC1 test4]# cat a.txt ## 测试数据 abd mnj uyr XDE THR QYE cvb Ddg gyi [root@PC1 test4]# sed 's/[a-z]/\U
阅读全文
摘要:001、 [root@PC1 test3]# ls test1 test2 [root@PC1 test3]# tree ## 测试数据 . ├── test1 │ └── a.txt └── test2 └── b.txt 2 directories, 2 files [root@PC1 test
阅读全文
摘要:001、 [root@PC1 test4]# ls a.txt [root@PC1 test4]# cat a.txt ## 测试数据 aa bb cc dd kk jj ee uu rr [root@PC1 test4]# sed -n l a.txt aa bb cc$ dd\tkk\tjj$
阅读全文
摘要:001、 [root@PC1 test4]# ls a.txt [root@PC1 test4]# cat a.txt ## 测试数据 ee ff 88 fff aa ff uuk fff uuuu kkk yyy fff kkkk [root@PC1 test4]# awk '{print len
阅读全文
摘要:001、匹配空格 [root@PC1 test4]# ls a.txt [root@PC1 test4]# cat a.txt ## 测试数据 1_aa bb 2_ccdd 3_ee ff 4_gg hh kk [root@PC1 test4]# sed -n l a.txt ## 显示出空格和制表
阅读全文
摘要:aaaa、#和%表示的是匹配删除 001、 # 表示从左侧删除匹配的字符, 单个#号表示非贪婪匹配, 两个#号表示贪婪匹配 [root@PC1 test]# ls [root@PC1 test]# var=http://www.aaa.com/123.htm ## 测试字符串 [root@PC1 t
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt b.txt c.txt [root@PC1 test]# find *.txt a.txt b.txt c.txt [root@PC1 test]# find *.txt | awk '{print "mv", $0, $0".bak"}
阅读全文
摘要:001、grep实现 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 234 fw3mh i86st sfg yzv e32kut zd7 utes eywq [root@PC1 test]# grep -o ".$" a.t
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 30 y 10 t 40 d 20 w ## 借助数组来实现 [root@PC1 test]# awk '{ay[NR] = $1; sum += $1} END {f
阅读全文
摘要:001、uname -m [root@PC1 ~]# uname -m x86_64 002、arch [root@PC1 ~]# arch x86_64 003、lscpu [root@PC1 ~]# lscpu
阅读全文