gpt4 book ai didi

linux - 如何在Linux中按标题将文本文件拆分为许多较小的文件

转载 作者:太空宇宙 更新时间:2023-11-04 05:21:15 25 4
gpt4 key购买 nike

我有一个包含数百篇新闻文章的大型 txt 文件,我想按标题将其分成几个较小的 txt 文件。

有人可以告诉我该怎么做吗?

最佳答案

使用split命令进行分割。

$ split --help
Usage: split [OPTION]... [INPUT [PREFIX]]
Output fixed-size pieces of INPUT to PREFIXaa, PREFIXab, ...; default
size is 1000 lines, and default PREFIX is `x'. With no INPUT, or when INPUT
is -, read standard input.

Mandatory arguments to long options are mandatory for short options too.
-a, --suffix-length=N use suffixes of length N (default 2)
-b, --bytes=SIZE put SIZE bytes per output file
-C, --line-bytes=SIZE put at most SIZE bytes of lines per output file
-d, --numeric-suffixes use numeric suffixes instead of alphabetic
-l, --lines=NUMBER put NUMBER lines per output file
--verbose print a diagnostic just before each
output file is opened
--help display this help and exit
--version output version information and exit

SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

关于linux - 如何在Linux中按标题将文本文件拆分为许多较小的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41740338/

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