我想按字节拆分文件,同时通过以下方式保持完整行
split -C <bytes> filename
Run Code Online (Sandbox Code Playgroud)
但是,默认拆分不接受 -C
split: illegal option -- C
usage: split [-a sufflen] [-b byte_count] [-l line_count] [-p pattern]
[file [prefix]]
Run Code Online (Sandbox Code Playgroud)
我已经brew install coreutils,看起来它应该支持我想要的。
如何更改 split 以使用 coreutils?
brew install coreutils默认情况下将安装以“g”为前缀的命令。所以split如果你输入gsplit.
如果您想使用原始名称的命令,请添加/usr/local/opt/coreutils/libexec/gnubin到您的$PATH.
有关更多信息,请参阅https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/和brew info coreutils。