上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 367 下一页
摘要: 001、字符串转换为shell数组 [root@PC1 test1]# str1="aa bb 100 200 500" ## 生成测试字符串 [root@PC1 test1]# echo $str1 aa bb 100 200 500 [root@PC1 test1]# ay1=($str1) # 阅读全文
posted @ 2024-02-10 22:43 小鲨鱼2018 阅读(251) 评论(0) 推荐(0) 编辑
摘要: 001、字符串变量传入awk,然后转换为数组 [root@PC1 test1]# str1="1 3 7 8" ## 测试字符串 [root@PC1 test1]# awk -v a="$str1" 'BEGIN{split(a, ay1, " "); print length(ay1)}' ## 阅读全文
posted @ 2024-02-10 22:27 小鲨鱼2018 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 001、先看整体结构 [root@PC1 test1]# ls ## 测试文件及目录 a.txt test001 test002 test003 [root@PC1 test1]# tree -h ## 查看结构和各个文件的大小 . ├── [ 59] a.txt ├── [ 30] test001 阅读全文
posted @ 2024-02-10 20:08 小鲨鱼2018 阅读(34) 评论(0) 推荐(0) 编辑
摘要: 001、 -w选项锁定 [root@PC1 test1]# ls a.txt [root@PC1 test1]# cat a.txt ## 测试文本 3432 dsab45cdf 887 abc 33333 77777 sdf fffabc 8888 ddd kk22,kk33k wwww sss 阅读全文
posted @ 2024-02-10 19:00 小鲨鱼2018 阅读(22) 评论(0) 推荐(0) 编辑
摘要: \w ## 匹配文字和数字字符,也就是[A-Za-z0-9], \W ## \w的反置形式,匹配一个或多个非单词字符,如点号句号等。 01、 [root@PC1 test1]# ls a.txt [root@PC1 test1]# cat a.txt ## 测试文本 3432 dsab45cdf 8 阅读全文
posted @ 2024-02-10 19:00 小鲨鱼2018 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 001、 -a: 显示所有目录及文件的大小 [root@PC1 test1]# ls ## 测试文件及目录 a.txt test001 test002 test003 [root@PC1 test1]# du -ah ## 输出所有文件及目录的大小 4.0K ./a.txt 1000M ./test 阅读全文
posted @ 2024-02-10 17:04 小鲨鱼2018 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试文件 yy 33 gg ss ff 11 zz mm dd 88 44 cc [root@PC1 test]# awk 'NF' a.txt ## 每行重复1次 yy 33 阅读全文
posted @ 2024-02-10 12:07 小鲨鱼2018 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试数据 444 777 222 999 eee 333 222 666 111 ggg sss fff zzz mmm nnn rrr ttt hhh [root@PC1 te 阅读全文
posted @ 2024-02-10 10:49 小鲨鱼2018 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 001、 a、总变量传入 [root@PC1 test1]# ls ## 测试文件及目录 a.txt b.txt c.csv test [root@PC1 test1]# tree ## 查看目录结构 . ├── a.txt ├── b.txt ├── c.csv └── test 1 direct 阅读全文
posted @ 2024-02-09 21:15 小鲨鱼2018 阅读(88) 评论(0) 推荐(0) 编辑
摘要: 001、 [root@PC1 test]# ls a.txt b.txt c.txt x.ped y.ped z.ped [root@PC1 test]# du -sh * ## 显示每个文件的大小 30M a.txt 60M b.txt 200M c.txt 20M x.ped 100M y.pe 阅读全文
posted @ 2024-02-09 18:37 小鲨鱼2018 阅读(9) 评论(0) 推荐(0) 编辑
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 367 下一页