Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on SPLIT command within the Unix/Linux forums, part of the Operating Systems category; Hi All I have a file that has over 5,00,000 records and I want to split the file into 65,500 rows. I am able to split the file into 7 ...
|
|||||||
|
|||
|
SPLIT command
Hi All
I have a file that has over 5,00,000 records and I want to split the file into 65,500 rows. I am able to split the file into 7 files using SPLIT command. I want to know if it is possible to attach a header for all the 7 files using a single script or a single command along with the SPLIT command. Help would be very much appreciated. Thanks Sharath |
| Sponsored Links |
|
|||
|
Re: SPLIT command
you can use -lnumber to tell split how many rows (or record if a row is a record) will be each file.
split -l65000 mi_huge_file_500000 after that split will create the files xaa, .... etc... if you want to put a header on each file create the header file and later do a cat on the following way: cat xaa >> header_file will append xaa to the header file, but becareful if you want to use the same header, you must replicate it, so you don't lose it. En fin... try with a script something more elaborated... I recommend you the advanced bash scripting guide http://www.tldp.org/LDP/abs/abs-guide.pdf HTH |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can i use substring function to split the second column | Geek_Guest | Data Warehousing | 0 | 04-10-2007 02:06 PM |
| How to split this entire row's contents into separate strings | JobHelper | SilkTest | 0 | 01-03-2007 05:32 PM |
| What is the command | StephenRaj | Unix/Linux | 1 | 08-20-2006 01:15 AM |
| Difference between split and csplit | sripri | Unix/Linux | 2 | 07-26-2006 05:02 PM |
| Help me with the command | joel | SQL | 1 | 07-23-2006 12:29 PM |