摘要:
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
阅读(646)
评论(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
阅读(81)
评论(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
阅读(152)
评论(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
阅读(63)
评论(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
阅读(204)
评论(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
阅读(77)
评论(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
阅读(61)
评论(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
阅读(34)
评论(0)
推荐(0)

浙公网安备 33010602011771号