🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.shell
Article #1029

Breaking large file into pieces

#1029
From: Mark A Monroe
Date: Tue, 11 Sep 1990 13:42
39 lines
1779 bytes
I want to rip a large file into pieces, naming new files according
to an ID string in the large file.  For example, the large file contains
records that look like this:

xxx-00001239	data	data	data
description
       .
       .
(variable length)
       .
						<---blank line
xxx-00001489	data	data	data
description
       .
       .
(variable length)
       .
						<---blank line
xxx-00001326	data	data	data

When I find a line in the large data file that starts
with "xxx-0000", I want to open a file named "xxx-0000<number>",
like "xxx-00001489", and write every line, including
the current one, into it.  When I see another "xxx-0000",
I want to close the file, open a new file named for the new id 
string, and continue writing.  At the end of the large data
file, close all files and exit.

Any suggestions?  

--


-------------------------- END OF MAIN MESSAGE -----------------------------
Mark A. Monroe  			
UNIX Release Integration	   Internet: monroe@dg-rtp.dg.com
Data General Corp.		   UUCP:     {world}!mcnc!rti!dg-rtp!monroe
Research Triangle Park, NC 	   Phone:    (919)248-6234       
----------------------------------------------------------------------------
Technical Details
Message-ID: <1990Sep11.134238.20218@dg-rtp.dg.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!uvaarpa!mcnc!rti!dg-rtp!dg-rtp.dg.com!monroe

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!uvaarpa!mcnc!rti!dg-rtp!dg-rtp.dg.com!monroe
From: monroe@dg-rtp.dg.com (Mark A Monroe)
Newsgroups: comp.unix.shell
Subject: Breaking large file into pieces
Message-ID: <1990Sep11.134238.20218@dg-rtp.dg.com>
Date: 11 Sep 90 13:42:38 GMT
Sender: usenet@dg-rtp.dg.com (Usenet Administration)
Reply-To: monroe@dg-rtp.dg.com (Mark A Monroe)
Organization: Data General Corporation, Research Triangle Park, NC
Lines: 39