gpt4 book ai didi

linux - 如何在 Linux BASH 上使用 split 在文件末尾添加编号后缀?

转载 作者:行者123 更新时间:2023-12-04 18:37:28 24 4
gpt4 key购买 nike

我在 Macbook 中使用 split 命令,而不是获取数字,而是获取诸如 output_aa、output_ab、output_ac 之类的文件,而我需要的是 output_1、output_2、output_3 等。

这是我正在使用的代码,它在一本书(哈利波特)的 .txt 上,我试图在章节之间拆分它,但是我需要我的 endfiles 具有与其章节相对应的数字。
split -p 章节 hp.txt hp_cap_

最佳答案

您可以使用 -d 选项

-d  use numeric suffixes starting at 0, not alphabetic

例子:
split -d hp.txt hp_cap_

输出:
hp_cap_00
hp_cap_01
hp_cap_02

关于linux - 如何在 Linux BASH 上使用 split 在文件末尾添加编号后缀?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60545516/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com