通过终端删除大文件的第一个和最后一个字符

Reu*_*ani 2 linux file

我有几个大文件(从 1GB 到 1TB),我想删除每个文件中的第一个和最后一个字符。

有什么快速的方法(最好使用简单的 bash 脚本)?我不需要保存旧文件。

Ign*_*ams 6

没有快速的方法可以在 shell 中完成此操作。

head -c -1 < in.txt | tail -c +1 > out.txt
Run Code Online (Sandbox Code Playgroud)

如果您不介意降到 C,则使用sendfile(2)1*offset的 a 和count小于 2 的 a 进行调用可能是最快的方法。