随笔分类 -  linux shell

上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 77 下一页
摘要:001、 +号的作用是匹配前面字符1次或连续任意多次 root@PC1:/home/test/test# ls a.txt root@PC1:/home/test/test# cat a.txt aaaabxa xxxxbxa root@PC1:/home/test/test# sed 's/a+/ 阅读全文
posted @ 2022-05-29 18:56 小鲨鱼2018 阅读(759) 评论(0) 推荐(0)
摘要:1、测试数据 root@PC1:/home/test/test# ls uma.txt root@PC1:/home/test/test# cat -A uma.txt 0^M^IAAACGCTGTAGCCA-1$ 0^M^IAAACTTGATCCAGA-1$ 1^M^IAAAGAGACGAGATA 阅读全文
posted @ 2022-05-28 21:39 小鲨鱼2018 阅读(153) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt a a b b c d e root@PC1:/home/test4# cat b.txt c d e f f g root@PC1:/home/test4 阅读全文
posted @ 2022-05-27 11:40 小鲨鱼2018 阅读(55) 评论(0) 推荐(0)
摘要:1、测试数据 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt a b c d e root@PC1:/home/test4# cat b.txt c d d xef e f g 2、grep -f选项的作用表示 阅读全文
posted @ 2022-05-27 11:30 小鲨鱼2018 阅读(2942) 评论(0) 推荐(0)
摘要:分类1:当两个文件没有重复项时。 1、测试数据 root@PC1:/home/test4# ls a.txt b.txt root@PC1:/home/test4# cat a.txt ## 测试数据 a b c d e root@PC1:/home/test4# cat b.txt c d e f 阅读全文
posted @ 2022-05-27 11:03 小鲨鱼2018 阅读(238) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## 脚本 #!/bin/bash ANSWER=$(expr $RANDOM % 100) TIMES=0 echo "the range is 0-100, 阅读全文
posted @ 2022-05-23 21:46 小鲨鱼2018 阅读(304) 评论(0) 推荐(0)
摘要:001、 root@PC1:/home/test2# ls root@PC1:/home/test2# a=abd root@PC1:/home/test2# echo $a abd root@PC1:/home/test2# [ $a =~ ^a ] && echo yes ## 单个[]不支持匹 阅读全文
posted @ 2022-05-23 21:07 小鲨鱼2018 阅读(875) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test2# ls test.sh root@PC1:/home/test2# cat test.sh ## script #!/bin/bash SUM=0 MIN=100 MAX=0 COUNT=0 while [ $COUNT -lt 5 ] do read 阅读全文
posted @ 2022-05-23 20:49 小鲨鱼2018 阅读(518) 评论(0) 推荐(0)
摘要:[[:alnum:]] = [a-zA-Z0-9] root@PC1:/home/test/test# ls a.txt root@PC1:/home/test/test# cat a.txt GMM 201 0 0 0 GMM 202 0 0 0 GMM 203 0 0 0 root@PC1:/h 阅读全文
posted @ 2022-05-16 23:26 小鲨鱼2018 阅读(433) 评论(0) 推荐(0)
摘要:001、 root@PC1:/home/test2# ls a.txt root@PC1:/home/test2# cat a.txt hello world root@PC1:/home/test2# sed 's/\(hello\) \(world\)/\2 \1/' a.txt ## 第一个小 阅读全文
posted @ 2022-05-16 00:35 小鲨鱼2018 阅读(106) 评论(0) 推荐(0)
摘要:1、系统 [root@PC1 network-scripts]# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: 7d8c7dacd42740ff9603a3e8bbf222da Boot 阅读全文
posted @ 2022-05-11 23:49 小鲨鱼2018 阅读(5246) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt i aaaadff f aaewrg k aaarbcd j aaaaavvvv i aaaaaaaaere root@PC1:/home/test# grep -E "a 阅读全文
posted @ 2022-05-09 23:13 小鲨鱼2018 阅读(669) 评论(0) 推荐(0)
摘要:1、sort -u实现 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt a b c x y z a b c m n o m n o root@PC1:/home/test# sort -u a.txt ## sort -u删除 阅读全文
posted @ 2022-05-09 19:23 小鲨鱼2018 阅读(343) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d xaa c xaaa d xaaaa e xaaaaa f xaaaaaa d dff gfgfgf e dfgdg gfdgedr d dfef fc 阅读全文
posted @ 2022-05-09 15:24 小鲨鱼2018 阅读(2147) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt ## 测试数据 d aab c aaab d aaaax e aaaaax f aaaaaax root@PC1:/home/test# grep -E "a{2}" a. 阅读全文
posted @ 2022-05-09 13:39 小鲨鱼2018 阅读(642) 评论(0) 推荐(0)
摘要:1、 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test# echo $b root@liujiaxinpc1:/home/test# [ $a ] ## 变量有赋值, 返回真 root@liujiaxinpc 阅读全文
posted @ 2022-05-06 16:44 小鲨鱼2018 阅读(553) 评论(0) 推荐(0)
摘要:-n: 当字符串不为0是为真; 字符串为0是为假。 n表示non-zero 示例: root@liujiaxinpc1:/home/test# a=100 root@liujiaxinpc1:/home/test# echo $a 100 root@liujiaxinpc1:/home/test# 阅读全文
posted @ 2022-05-06 16:31 小鲨鱼2018 阅读(8601) 评论(0) 推荐(0)
摘要:原文:https://blog.csdn.net/coolfishbone_joey/article/details/119956378 echo 显示内容颜色,需要使用 -e 参数 -e :打开反斜杠转义 (默认不打开) ,可以转义 “\n, \t” 等 -n:在最后不自动换行 str="kimb 阅读全文
posted @ 2022-05-06 11:23 小鲨鱼2018 阅读(597) 评论(0) 推荐(0)
摘要:1、举例1: root@PC1:/home/test# ls test.sh root@PC1:/home/test# cat test.sh #!/bin/bash read -p "please input a character: " KEY case $KEY in ## 利用变量KEY进行 阅读全文
posted @ 2022-05-06 10:42 小鲨鱼2018 阅读(197) 评论(0) 推荐(0)
摘要:1、统计频次 [root@localhost test]# ls a.txt [root@localhost test]# cat a.txt a a b a b a b b b b [root@localhost test]# awk '{array[$1]++} END {for(i in ar 阅读全文
posted @ 2022-05-05 23:40 小鲨鱼2018 阅读(107) 评论(0) 推荐(0)

上一页 1 ··· 41 42 43 44 45 46 47 48 49 ··· 77 下一页