Fork me on GitHub

Linux -- 统计文件的行数

统计单个文件有多少行

方法1:  awk '{print NR}' test1.sh|tail -n1

方法2:  awk 'END{print NR}' test1.sh

方法3:  grep -n "" test1.sh|awk -F: '{print '}|tail -n1

方法4:  sed -n '$=' test1.sh
方法5:  wc -l test1.sh

方法6:  cat test1.sh |wc -l

 

posted @ 2015-10-23 11:57  Roronoa__Zoro  阅读(198)  评论(0编辑  收藏  举报