Re: [OT] splitting files based on keyword
On Tue, Jun 21, 2005 at 09:57:07PM -0400, kamaraju kusumanchi wrote:
> I have a large text file (humongous.txt) with the following structure
>
>
> date 1-1-2005
> line1
> line2
> date 1-2-2005
> line3
> line4
> date 1-3-2005
> line5
> line6
> line7
> line8
> .....
>
> Is there any tool which will split the above file and give me three
> smaller files 1-1-2005.txt, 1-2-2005.txt, 1-3-2005.txt etc., where
>
awk '$1=="date"{close outfile; outfile=$2 ".txt"} {print > outfile}'
--
Support Our Oops!
Reply to: