linux 中同时统计文件的行数和列数
1、测试数据
[root@centos7 test4]# ls
test.txt
[root@centos7 test4]# cat test.txt
d j k j
x m y e
s g j i
x v b d
z c e t
2、统计行数和列数
[root@centos7 test4]# ls test.txt [root@centos7 test4]# cat test.txt d j k j x m y e s g j i x v b d z c e t [root@centos7 test4]# awk '{i++} END {print FILENAME, i, NF}' test.txt ## 5行4列 test.txt 5 4

浙公网安备 33010602011771号