gpt4 book ai didi

linux - 如何使用 csplit 命令按天拆分日志文件?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:51:53 25 4
gpt4 key购买 nike

我有一个如下所示的日志文件:

Jan 01  This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 01 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 02 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.
Jan 03 This the log of this day.

如何按天拆分文件?我使用命令:

csplit 日志/*Jan 01*//*Jan 02*//*Jan 03*/

但是有错误:

csplit: /*Jan: closing delimiter '/' missing

所以有人可以告诉我如何解决这个问题吗?提前致谢。

最佳答案

shell 将 /*Jan 视为一个参数,将 01*/ 视为另一个参数,依此类推。您需要引用包含空格的参数。

csplit log '/*Jan 01*/' '/*Jan 02*/' '/*Jan 03*/'

关于linux - 如何使用 csplit 命令按天拆分日志文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30463200/

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