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
1-1-2005.txt will be
date 1-1-2005
line1
line2
1-2-2005.txt will be
date 1-2-2005
line3
line4
1-3-2005.txt will be
line5
line6
line7
line8
There is absolutely no correlation between the date and the number of
lines that it might contain. I just chose 3 dates, But in my file there
are about 1000 such sections and I do not want to do it manually. I am
wondering if there is any tool out there which does the above job.
I can do it with c or fortran but that does not appear to be elegant.
I looked at split, csplit. But they dont seem to do this. Googling did
not help much. Any other ideas?
raju
I can't think of any CL tools that would do this just for you, but it
would be trivial to write a Java program to do this.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]