随笔分类 - linux shell
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 afdf eDET FDSS FFde fexk mxnd ## 此处应该是个2 [root@PC1 test]# cat a.txt | awk '{for(i =
阅读全文
摘要:001、大写转换为小写 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 ab cD EF HI KL mn Op qM [root@PC1 test]# sed 's/[A-Z]/\L&/g' a.txt ## 所有的大写转换
阅读全文
摘要:001、 >>> list1 ## 测试列表 ['chicken', 'duck', 'goose', 'iron', 'xxx'] >>> list1[:3] ## 前三个 ['chicken', 'duck', 'goose'] >>> list1[-3:] ## 后三个 ['goose', '
阅读全文
摘要:001、 [sy20213040737@admin2 test]$ cat a.txt ## 测试数据 3 8 34 50 [sy20213040737@admin2 test]$ awk '{if(NR == 1){tmp = $1} else {print $1 - tmp; tmp = $1}
阅读全文
摘要:Linux 中 awk命令如何截取指定字段的前几个字符。 01、 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt ## 测试数据 34 kjhge 31 dsbed 23 kmfeq 35 ewkmn [root@lo
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt idx.txt [root@PC1 test]# cat a.txt 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据如下 a 8 a 3 b 2 e 2 d 10 b 3 b 7 e 4 [root@PC1 test]# awk '{ay[$1] += $2; ay2[$1]++} E
阅读全文
摘要:001、 简单测试 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt ## 测试数据 dfghghj hgfdwe [root@localhost test]# sed 'G' a.txt ## G在每一行添加空行 df
阅读全文
摘要:001、 sed实现 [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 21 22 23 24 25 26
阅读全文
摘要:001、 for i in {1..10}; do ps -aux | grep "ascp" | grep "b20223040323" | awk '{print $2}' | xargs kill; sleep 5; done 。 nohup 递交任务应该是每一行执行一个进程号;因此杀掉一个进
阅读全文
摘要:001、 [sy20213040737@admin2 test]$ ls a.txt [sy20213040737@admin2 test]$ cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23
阅读全文
摘要:这种问题存在于PATH 和 要加载的路径中存在相同的环境变量名,而起作用的是前者的环境变量 001、 a、如果PATH+ 路径中存在同名环境变量, 路径中环境变量生效。 b、如果路径 + PATH中存在相同的环境变量,路径中的环境变量生效。
阅读全文
摘要:001、环境变量混乱出现如下问题 [root@PC1 ~]# ls ## 基本命令调不起来 bash: ls: command not found... Similar command is: 'lz' [root@PC1 ~]# vim ~/.bashrc ## vim编辑器也调不起来 bash:
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 >Sequence1 CCCNTCACTNNNCTTGGNNNNNNNNN >Sequence2 [root@PC1 test]# sed 's/NNN\+//g' a
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据,三列数据 324324 aeddeef uukkiikk sssfee ffeeeww eeffzzdd zzzves ggeessa jjxxddqq aaeekk
阅读全文
摘要:001、 find ./ -type f -name "*fasta" -size +100M -size -200M ## 查找文件类型未文件; 名称未最后几个字符fasta, 文件的大小大于100M, 小于200M 。
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt 33 aa 44 aa 88 aa 33 aa ff kk 33 aa 88 22 mm 88 33 44 22 99 [root@PC1 test]# sed '2 s/.*/\n&
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数 aa bbb dd ff 77 dd 22 44 77 88 cc dd ee ff [root@PC1 test]# sed -n '/dd/p' a.txt ## 输
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 aa 33 aa 77 bb aa aa 22 aa kk cc bb dd aa uu 88 33 88 rr qq [root@PC1 test]# grep -o
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 aa bbbbbb cc bb ww xx yy zz dd jj kk mm ss [root@PC1 test]# awk '{sub("b+", "Q"); pr
阅读全文