001、
[root@pc1 test3]# ls test.txt [root@pc1 test3]# cat test.txt ## 测试数据 addg ad adfgg d dfg [root@pc1 test3]# awk '{print length}' test.txt 4 2 5 1 3
002、awk
[root@pc1 test3]# ls test.txt [root@pc1 test3]# cat test.txt addg ad adfgg d dfg [root@pc1 test3]# awk -F "" '{print NF}' test.txt ## awk实现 4 2 5 1 3
003、awk
[root@pc1 test3]# ls test.txt [root@pc1 test3]# cat test.txt ## 测试数据 addg ad adfgg d dfg [root@pc1 test3]# awk '{print gsub(/./,"&")}' test.txt ## awk实现 4 2 5 1 3
标签:字符,test3,pc1,awk,linux,test,长度,txt,root From: https://www.cnblogs.com/liujiaxin2018/p/16790610.html