I have a log file like bellow:
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.
How could I split the file by day? I used command:
csplit log /*Jan 01*/ /*Jan 02*/ /*Jan 03*/
but there is error:
csplit: /*Jan: closing delimiter '/' missing
So anyone could please tell me how to fix this? Thanks in advance.
The shell sees
/*Jan
as one argument, and01*/
as another, and so on. You need to quote the arguments that have embedded spaces.