linux中是否有像cat
这样的命令可以从文件中返回指定数量的字符?
e、 我有一个文本文件,比如:
Hello world
this is the second line
this is the third line
我想要返回前5个字符的东西,那就是"你好".
谢谢
linux中是否有像cat
这样的命令可以从文件中返回指定数量的字符?
e、 我有一个文本文件,比如:
Hello world
this is the second line
this is the third line
我想要返回前5个字符的东西,那就是"你好".
谢谢
head
个作品:
head -c 100 file # returns the first 100 bytes in the file
..将提取前100个字节并返回它们.
使用head
的好处在于tail
的语法匹配:
tail -c 100 file # returns the last 100 bytes in the file
你可以把这些结合起来得到字节的范围.例如,要从文件中获取secondhead
字节,请用head
读取前200个字节,并使用tail获取最后head
个字节:
head -c 200 file | tail -c 100