Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

split(1) [plan9 man page]

SPLIT(1)						      General Commands Manual							  SPLIT(1)

split - split a file into pieces SYNOPSIS
split [ option ... ] [ file ] DESCRIPTION
Split reads file (standard input by default) and writes it in pieces of 1000 lines per output file. The names of the output files are xaa, xab, and so on to xzz. The options are -n Split into n-line pieces. -e expression File divisions occur at each line that matches a regular expression; see regexp(6). Multiple -e options may appear. If a subex- pression of expression is contained in parentheses (...), the output file name is the portion of the line which matches the subex- pression. -f stem Use stem instead of x in output file names. -s suffix Append suffix to names identified under -e. -x Exclude the matched input line from the output file. -i Ignore case in option -e; force output file names (excluding the suffix) to lower case. SOURCE
/sys/src/cmd/split.c SEE ALSO
sed(1), awk(1) grep(1), regexp(6) SPLIT(1)

Check Out this Related Man Page

SPLIT(1)						    BSD General Commands Manual 						  SPLIT(1)

split -- split a file into pieces SYNOPSIS
split -d [-l line_count] [-a suffix_length] [file [prefix]] split -d -b byte_count[K|k|M|m|G|g] [-a suffix_length] [file [prefix]] split -d -n chunk_count [-a suffix_length] [file [prefix]] split -d -p pattern [-a suffix_length] [file [prefix]] DESCRIPTION
The split utility reads the given file and breaks it up into files of 1000 lines each (if no options are specified), leaving the file unchanged. If file is a single dash ('-') or absent, split reads from the standard input. The options are as follows: -a suffix_length Use suffix_length letters to form the suffix of the file name. -b byte_count[K|k|M|m|G|g] Create split files byte_count bytes in length. If k or K is appended to the number, the file is split into byte_count kilobyte pieces. If m or M is appended to the number, the file is split into byte_count megabyte pieces. If g or G is appended to the num- ber, the file is split into byte_count gigabyte pieces. -d Use a numeric suffix instead of a alphabetic suffix. -l line_count Create split files line_count lines in length. -n chunk_count Split file into chunk_count smaller files. -p pattern The file is split whenever an input line matches pattern, which is interpreted as an extended regular expression. The matching line will be the first line of the next output file. This option is incompatible with the -b and -l options. If additional arguments are specified, the first is used as the name of the input file which is to be split. If a second additional argument is specified, it is used as a prefix for the names of the files into which the file is split. In this case, each file into which the file is split is named by the prefix followed by a lexically ordered suffix using suffix_length characters in the range ``a-z''. If -a is not speci- fied, two letters are used as the suffix. If the prefix argument is not specified, the file is split into lexically ordered files named with the prefix ``x'' and with suffixes as above. ENVIRONMENT
The LANG, LC_ALL, LC_CTYPE and LC_COLLATE environment variables affect the execution of split as described in environ(7). EXIT STATUS
The split utility exits 0 on success, and >0 if an error occurs. SEE ALSO
csplit(1), re_format(7) STANDARDS
The split utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
A split command appeared in Version 3 AT&T UNIX. BUGS
The maximum line length for matching patterns is 65536. BSD
May 9, 2013 BSD
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

calling external values inside awk command

I have a code as follows awk ' BEGIN{FS=OFS=","} { n=split($3,a1,"~") split($4,a2,"~") split($5,a3,"~") for(i=1;i<=n;i++) { print $1,$2,a1,a2,a3,date } }' file In the above code I need to add current date(date). How is this possible to call an date or a exported value... (13 Replies)
Discussion started by: tkbharani
13 Replies

2. UNIX for Dummies Questions & Answers

Please Help:Need to Split the file into mutliple files depends on the KEY field value

Hi Gurus, I am new to UNIX(HP). my requirmnet is File needs to needs to be split into multiple files dependa on one key value. example 1 abc 333 us 2 bbc 444 ch 5 nnn 333 kk 7 hhh 555 ll 3 hhh 333 hh now the requirment is line with 333 should be copied into test1.txt and... (14 Replies)
Discussion started by: arund_01
14 Replies

3. Shell Programming and Scripting

split single line into two line or three lines

Dear All, I want to split single line into two line or three lines wherever | separated values comes using Input line test,DEMTEMPUT20100404010012,,,,,,,,|0070086|0070087, output shoule be test,DEMTEMPUT20100404010012,,,,,,,,0070086, test,DEMTEMPUT20100404010012,,,,,,,,0070087, (14 Replies)
Discussion started by: arvindng
14 Replies

4. Shell Programming and Scripting

Help with AWK and Scripting!

Hi, This is the first time I am working with awk and I am not familiar with any commands in it. But I managed to do most of my work just left with one more. Needing your help! I have to extract only the matrix (written within ) from a text file. For example: 1JTJ_0006_ACGC_NPNP_A_12_15.pdb ... (17 Replies)
Discussion started by: SriJit
17 Replies

5. Shell Programming and Scripting

Split line in to 3 lines

Hi, I have a file which contains 1000's of lines. Each line is a log which is pretty long. So i want to split the each line based on 3 category. 1> Date 2><REQUEST> 3><RESPONSE> So below is the example of a line. 2010-11-16 00:45:12,314<REQUEST><VALIDATION-ERROR><soapenv:Envelope... (16 Replies)
Discussion started by: raghunsi
16 Replies

6. Shell Programming and Scripting

Split into columns based on the parameter and use & as delimiter

Here is my source, i have million lines like this on a file. disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=& drc=&mo=&sid=&lang=EN&loc=JPN I want to split this into columns in order to load in database, anything starts with"&mjv=6" as first... (13 Replies)
Discussion started by: elamurugu
13 Replies

7. Shell Programming and Scripting

delimiting using sed command

Hi, I have an output after performing a grep: FAN and i did awk '{print $2}' it shows: is there a way, by using sed that it will only show output as NO_FAULT without the brackets ? i tried doing sed 's/^*//' but the output is NO_FAULT] with the ] at the... (12 Replies)
Discussion started by: mosies
12 Replies

8. Shell Programming and Scripting

adding a number with sed or awk.

Hi.. I have this delicate problem..:wall: I have this huge ldif file with entry's like this example below.. And I need to change the following entrys. telephoneNumber: emNotifNumber: billingnumber= BillingNumber: Al these entrys has a number like 012345678 and it needs to add one more... (15 Replies)
Discussion started by: pelama
15 Replies

9. UNIX for Dummies Questions & Answers

Split binary file every occurrence of a group of characters

Hello I am new to scripts, codes, bash, terminal, etc. I apologize this my be very scattered because I frankly don't have any idea where to begin and I have had trouble sleeping lately. I have several 2GB files I wish to split. This Code 00 00 01 BA ** ** ** ** ** ** ** ** C3 F8 00 00 01 BB 00... (17 Replies)
Discussion started by: PatrickE
17 Replies

10. UNIX for Advanced & Expert Users

Help using awk with a text file

Basically I have a text file that is made up of customer statements. I want to be able to separate the customer statements into their own file. The file is consistant in that the account # (part of the key) is always on line 10 then on every 55th line from there on out so my logic would be like: ... (17 Replies)
Discussion started by: ziggy6
17 Replies

11. Shell Programming and Scripting

Split a line into next line

Hi All, I have user input file like below:- emplid|empl_name|salary|hire_date 1111|gro|3000|01/01/2014 1111|ghgo|4000|01/03/2014 1111|dkguo|5000|02/01/2014 1111|ehrt|6000|01/04/2014 1111|kfgtr|8000|03/01/2014 Sometimes input file will look like below.... (21 Replies)
Discussion started by: krupasindhu18
21 Replies

12. UNIX for Dummies Questions & Answers

Split large file to smaller fastly

hi , I have a requirement input file: 1 1111111111111 108 1 1111111111111 109 1 1111111111111 109 1 1111111111111 110 1 1111111111111 111 1 1111111111111 111 1 1111111111111 111 1 1111111111111 112 1 1111111111111 112 1 1111111111111 112 The output should be, (19 Replies)
Discussion started by: mechvijays
19 Replies

13. OS X (Apple)

Noob trying to improve

Hi everyone! This is my first post here, I hope that I will not already be violating any rule! I also would like to apologize in advance as my post will definitely be a noob post... please have patience and faith :rolleyes:! Now that I have set the ground rules :D:D, my objective is trying... (39 Replies)
Discussion started by: Ardzii
39 Replies

14. UNIX for Beginners Questions & Answers

Split and Rename Split Files

Hello, I need to split a file by number of records and rename each split file with actual filename pre-pended with 3 digit split number. What I have tried is the below command with 2 digit numeric value split -l 3 -d abc.txt F (# Will Produce split Files as F00 F01 F02) How to produce... (19 Replies)
Discussion started by: techedipro
19 Replies

15. UNIX for Beginners Questions & Answers

Split large file into 24 small files on one hour basis

I Have a large file with 24hrs log in the below format.i need to split the large file in to 24 small files on one hour based.i.e ex:from 09:55 to 10:55,10:55-11:55 can any one help me on this.! ... (20 Replies)
Discussion started by: Raghuram717
20 Replies