随笔分类 - linux shell
摘要:Linux 中sed命令的整行替换. 001、基本用法 [root@PC1 test2]# ls a.txt [root@PC1 test2]# cat a.txt ## 测试文件 a UU i a UU i b q j c q y [root@PC1 test2]# sed '/b/ s/.*/Q
阅读全文
摘要:001、 Linuxbash和source命令的区别在于,当你用bash命令执行脚本时,它告诉Linux内核创建一个新的Bash进程来读取和执行脚本,将输出复制到原先的shell进程中,并显示下来. 然而source命令是一个外置的shell,它读取和评估当前shell进程中的文件。为此,脚本所做的
阅读全文
摘要:Linux 中declare命令 001、普通测试 [root@PC1 dir1]# ls [root@PC1 dir1]# echo $var1 [root@PC1 dir1]# var1="hello world" [root@PC1 dir1]# echo $var1 hello world
阅读全文
摘要:001、-L :按照换行符的数量来传递 [root@PC1 dir1]# ls [root@PC1 dir1]# echo {0..9} 0 1 2 3 4 5 6 7 8 9 [root@PC1 dir1]# echo {0..9} | xargs -L 2 ## 利用echo生成一个1行的测试数
阅读全文
摘要:Linux shell中如何一次迭代传入多个变量
阅读全文
摘要:001、 Linux 中sort命令 排序指定两个-k异常 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 4 a 8 5 7 a 3 8 2 b 5 3 3 b 9 5 5 a 6 9 9 b 1 4 7 a 6 3 2 a
阅读全文
摘要:Linux中grep命令实现带有通配符.关键字符的精准匹配 001、 [b20223040323@admin2 test]$ ls a.txt [b20223040323@admin2 test]$ cat a.txt ## 测试文件 new_seq KRA6 Karakaya new_seq ss
阅读全文
摘要:001、 Linux 中 awk正则匹配屏蔽原始字符串 [b20223040323@admin2 test]$ ls a.txt [b20223040323@admin2 test]$ cat a.txt ## 测试文件 0M6 FKDN240280192-1A 0.51 Fail 0M7 FKDN
阅读全文
摘要:001、第一列 [root@localhost test]# ls a.txt [root@localhost 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@loc
阅读全文
摘要:001、 [root@PC1 test]# echo a | awk 'function my_length(str) {return length(str)}; {text = "Hello"; print "Length of text:", my_length(text)}' Length o
阅读全文
摘要:Linux 中 如何实现数字每个三个数字增加一个逗号 001、 [s20223040682@admin1 test]$ ls a.txt [s20223040682@admin1 test]$ cat a.txt 23453245533 9706634552 356662212 34566 [s20
阅读全文
摘要:001、 (base) [s20213040583@admin1 test]$ ls a.txt (base) [s20213040583@admin1 test]$ cat a.txt ## 测试数据 01 02 03 04 ATCkkCAA GGAaattTGccggCCAA ATCCAA05
阅读全文
摘要:001、 (base) [s20213040583@admin1 test]$ ls a.txt (base) [s20213040583@admin1 test]$ cat a.txt ## 测试数据 01 02 03 04 05 06aa 0aa7 08 09 10 1aa1 12 13 14d
阅读全文
摘要:001、 通常做法 [root@localhost test]# time seq 10 > a.txt 2> xxx ## 完全追加至xxx real 0m0.002s user 0m0.000s sys 0m0.002s [root@localhost test]# ls a.txt xxx [
阅读全文
摘要:001、 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt ## 测试数据 j003_mappingrate.txt KRA6 97.79% wild_mappingrate.txt KR.6 98.53% j004_m
阅读全文
摘要:001、 [s20223040682@admin2 test]$ echo hollo@world | fold -w 1 h o l l o @ w o r l d [s20223040682@admin2 test]$ echo hollo@world | fold -w 2 ho ll o@
阅读全文
摘要:001、 (base) [root@PC1 test]# ls a.txt idx.txt (base) [root@PC1 test]# cat a.txt ## 测试数据 01 02 03 04 05 06a 07 08 09 10 11 12 13 14b 15 16 17 18 19 20
阅读全文