Linux统计代码行数
来源:互联网 发布:java log日志输出 编辑:程序博客网 时间:2024/06/06 08:23
语法:wc [选项] 文件…
说明:该命令统计给定文件中的字节数、字数、行数。如果没有给出文件名,则从标准输入读取。wc同时也给出所有指定文件的总统计数。字是由空格字符区分开的最大字符串。
该命令各选项含义如下:
- c 统计字节数。
- l 统计行数。
- w 统计字数。
这些选项可以组合使用。
输出列的顺序和数目不受选项的顺序和数目的影响。
总是按下述顺序显示并且每项最多一列。
行数、字数、字节数、文件名
如果命令行中没有文件名,则输出中不出现文件名。
例如:
$ wc - lcw file1 file2
4 33 file1
7 52 file2
11 11 85 total
举例分析:
1.统计demo目录下,js文件数量:
find demo/ -name "*.js" |wc -l
2.统计demo目录下所有js文件代码行数:
find demo/ -name "*.js" |xargs cat|wc -l 或 wc -l `find ./ -name "*.js"`|tail -n1
3.统计demo目录下所有js文件代码行数,过滤了空行:
find /demo -name "*.js" |xargs cat|grep -v ^$|wc -l
0 0
- Linux 统计代码行数
- Linux 统计代码行数
- Linux 统计代码行数
- linux统计代码行数
- linux 统计代码行数
- Linux 统计代码行数
- Linux 统计代码行数
- Linux统计代码行数
- Linux统计代码行数
- linux统计代码行数
- Linux统计代码行数
- 【Linux】Linux 统计代码行数
- linux下统计代码行数
- Linux下统计代码行数
- LINUX下统计代码行数
- linux下统计代码行数
- LINUX下统计代码行数
- Linux下统计代码行数
- [iOS_Dev] Win平台 搭建 iOS开发环境 ---- 使用VMWare虚拟机
- 第十四周项目1-折腾二维数组
- ListView的基本使用与优化
- servlet get和post的区别
- JSP中使用CKEditor的简单例子
- Linux统计代码行数
- 杨辉三角形
- TNS-12518: TNS:listener could not hand off client connection & Broken pipe
- Android 多线程断点下载技术分享
- VMWare下快速搭建Hadoop完全分布式环境
- 【瞎搞】 HDU 5112 A Curious Matt 水
- ios 视图之弹窗
- 第14周项目2-(1)
- yourphp下修改留言板