Breaking large file into pieces

Leslie Mikesell les at chinet.chi.il.us
Thu Sep 13 05:47:32 AEST 1990


In article <1990Sep11.134238.20218 at dg-rtp.dg.com> monroe at 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 at chinet.chi.il.us



More information about the Comp.unix.shell mailing list