linux切割文件

linux split 命令

  功能说明:切割文件。

  语  法:split [--help][--version][-<行数>][-b <字节>][-C <字节>][-l <行数>][要切割的文件][输出文件名]

  补充说明:split可将文件切成较小的文件,预设每1000行会切成一个小文件。

  参  数:

  -<行数>或-l<行数>  指定每多少行就要切成一个小文件。

  -b<字节>  指定每多少字就要切成一个小文件。支持单位:m,k

  -C<字节>  与-b参数类似,但切割时尽量维持每行的完整性。

  --help  显示帮助。

  --version  显示版本信息。

  [输出文件名]  设置切割后文件的前置文件名,split会自动在前置文件名后再加上编号。

  使用例子:

  split -b 100m filename




wc命令用来打印文件的文本行数、单词数、字节数等(print the number of newlines, words, and bytes in files)。在Windows的Word中有个“字数统计”的工具,可以帮我们把选中范围的字数、字符数统计出来。Linux下的wc命令可以实现这个 功能。使用vi打开文件的时候,底下的信息也会显示行数和字节数。
常用参数

格式:wc -l <file>

打印指定文件的文本行数。(l=小写L)

以下参数可组合使用。

参数:-c, --bytes[喝小酒的网摘]http://blog.hehehehehe.cn/a/17301.htm
打印字节数(print the byte counts)

参数:-m, --chars
打印字符数(print the character counts)

参数:-l, --lines
打印行数(print the newline counts)

参数:-L, --max-line-length
打印最长行的长度(print the length of the longest line)

参数:-w, --words
打印单词数(print the word counts)
使用示例
示例一

[root@jfht ~]# wc /etc/passwd
  46   66 2027 /etc/passwd

行数 单词数 字节数 文件名

猜你喜欢

转载自www.cnblogs.com/gavinwu-blog/p/10088610.html
今日推荐