[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggestion for split.c

From: Galbraith, Mark
Subject: Suggestion for split.c
Date: Thu, 7 Aug 2003 15:01:40 -0500

First, let me preface this by saying that I'm a new list member, and have not seen any previous posts made to this list.  If this, or something similar, has already been posted and discussed, please forgive me.  Pointers to any list archives would be appreciated.
I have a suggestion for a new option and function for the split(1) program.  I would like to explore adding the capability to specify a number of rows from the top of the source file that will be COPIED to the start of each file produced by split(1). 
As an example,  I have a file that contains 10,000 rows, the first line being a header row.  I want to split this file into files that contain 1,000 rows each, but I want each output file to also start with the header row.
I realize that this would invalidate one of the nice features of the current versions of split(1).  That being that a "Split" file can always be reconstructed using cat(1).  As the default operation of split(1) would be to continue the current method (no header row copying), I think this "feature" is safe.
My suggestion is to use an option like "-H n" (or other option letter as may be determined by the maintainer of split.c) to specify the number of rows that constitute the "Header" of the source file.  A maximum number of rows would be need to be determined.  I suggest a maximum of 256 lines.  While the file is first being processed, these lines can be copied into a malloc'd buffer that would be output to the new files created.
I'm sure the design and coding of this will be a topic for discussion as we refine the requirement and design.  I'm very willing to perform the design and coding of this change, however I wanted to discuss the change here first.  Please let me know if you have any questions.
Mark Galbraith
Managed Services Team Leader
Data Return LLC

reply via email to

[Prev in Thread] Current Thread [Next in Thread]