1

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

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 log /*Jan 01*/ /*Jan 02*/ /*Jan 03*/

但有错误:

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

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

4

1 回答 1

1

shell 将/*Jan其视为一个论点,并01*/视为另一个论点,依此类推。您需要引用嵌入空格的参数。

csplit log '/*Jan 01*/' '/*Jan 02*/' '/*Jan 03*/'
于 2015-05-26T16:10:00.030 回答