Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!olivea!orc!inews!iwarp.intel.com!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.shell Subject: Re: Breaking large file into pieces Message-ID: <1990Sep12.194732.18353@chinet.chi.il.us> Date: 12 Sep 90 19:47:32 GMT References: <1990Sep11.134238.20218@dg-rtp.dg.com> Organization: Chinet - Chicago Public Access UNIX Lines: 28 In article <1990Sep11.134238.20218@dg-rtp.dg.com> monroe@dg-rtp.dg.com (Mark A Monroe) writes: >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 The perl suggestions are the best if you have perl, and it can be done directly in awk if you have the new awk that can close files. I did this sort of thing years ago using: awk |sh where the awk program generates a stream something like: cat > filename1 <<\!EOF data !EOF cat > filename2 <<\!EOF data !EOF Les Mikesell les@chinet.chi.il.us