Path: utzoo!attcan!utgpu!watmath!att!dptg!rutgers!sun-barr!cs.utexas.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.questions Subject: Re: file too large Message-ID: <2477@auspex.auspex.com> Date: 21 Sep 89 19:19:59 GMT References: <2388@netcom.UUCP> <1226@xyzzy.UUCP> <10554@eerie.acsu.Buffalo.EDU> Reply-To: guy@auspex.auspex.com (Guy Harris) Organization: Auspex Systems, Santa Clara Lines: 35 > >I have a text file that is very large (26,000+ lines) and would like > >to break it down to 5-6 smaller files. Is there an easy way to handle > >this? I have tried vi but, it seems to hold 5000 lines in its buffer. > >The same goes for ed and ex. > >There is a program called csplit that should do the trick. There is a program called "csplit" in some, but not all, versions of UNIX that might do the trick; it splits based on "context" (which is presumably what the "c" in "csplit" stands for). From the SunOS 4.0 man page: DESCRIPTION csplit reads the file whose name is filename and separates it into n+1 sections, defined by the arguments argument1 through argumentn. If the filename argument is a `-', the standard input is used. By default the sections are placed in files named xx00 through xxn. n may not be greater than 99. These sections receive the following portions of the file: xx00 From the start of filename up to (but not including) the line indicated by argument1 (see OPTIONS below for an explanation of these arguments.) xx01: From the line indicated by argument1 up to the line indicated by argument2. xxn: From the line referenced by argumentn to the end of filename. However, it is, as noted, not present in all versions of UNIX; it doesn't come with 4.xBSD, for instance. "split", which splits based on line count, is present in all versions of UNIX AT&T has shipped, and is, as such, more likely to be present in any given version of UNIX (it is in 4.xBSD).