问题描述
我想按字节分割文件,同时通过保持整行
I'd like to split a file by bytes while maintaining full lines via
split -C <bytes> filename
但是,默认拆分不接受-C
However, the default split doesn't accept -C
split: illegal option -- C
usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]
[file [prefix]]
我有brew install coreutils
,其中看起来像它应该支持我想要的.
如何更改split以使用coreutils?
How do I change split to use coreutils?
推荐答案
brew install coreutils
将默认安装以'g'开头的命令.因此,如果键入gsplit
,则split
应该可用.您可以通过使用选项--with-default-names
安装软件包来以普通名称安装命令.
brew install coreutils
will install the commands prefixed with 'g' by default. So split
should be available if you type gsplit
. You can install the commands with normal names by installing packages with option --with-default-names
.
有关更多信息,请参见"> https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
For more information, see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
这篇关于Mac bash拆分无法按行字节拆分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!