07-01-2019
Bash shell and os is Linux
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to split a large file into small files based on a string.
At different palces in the large I have the string ^Job.
I need to split the file into different files starting from ^Job to the last character before the next ^Job.
Also all the small files should be automatically named.... (4 Replies)
Discussion started by: dncs
4 Replies
2. Shell Programming and Scripting
Hi
I want to split a file that has 'n' number of records into 16 small files.
Can some one suggest me how to do this using Unix script?
Thanks
rrkk (10 Replies)
Discussion started by: rrkks
10 Replies
3. Shell Programming and Scripting
I have one large file, after every 200 line i have to split the file and the add header and footer to each small file?
It is possible to add different header and footer to each file? (7 Replies)
Discussion started by: ashish4422
7 Replies
4. Shell Programming and Scripting
Dear All,
Could you please help me to split a file contain around 240,000,000 line to 4 files all equally likely , note that we need to maintain that the end of each file should started by start flage (MSISDN) and ended by end flag (End), also the number of the line between the... (10 Replies)
Discussion started by: ahmed.gad
10 Replies
5. Shell Programming and Scripting
I have a large zone file dump that consists of
; DNS record for the adomain.com domain
data1
data2
data3
data4
data5
CRLF
CRLF
CRLF
; DNS record for the anotherdomain.com domain
data1
data2
data3
data4
data5
data6
CRLF (7 Replies)
Discussion started by: Bluemerlin
7 Replies
6. Shell Programming and Scripting
Hi,
I need to split a large array "@sharedArray" into 10 small arrays.
The arrays should be like @sharedArray1,@sharedArray2,@sharedArray3...so on..
Can anyone help me with the logic to do so :(:confused: (6 Replies)
Discussion started by: rkrish
6 Replies
7. Shell Programming and Scripting
Dear shell experts,
I would like to spilt a txt file into small ones. However, I did not know how to program use shell. If someone could help, it is greatly appreciated!
Specifically, I supposed there is file named A.txt. The content of the file likes this:
Subject run condtion ACC time... (3 Replies)
Discussion started by: psychmyluo
3 Replies
8. Shell Programming and Scripting
Dear all,
I have huge txt file with the input files for some setup_code. However for running my setup_code, I require txt files with maximum of 1000 input files
Please help me in suggesting way to break down this big txt file to small txt file of 1000 entries only.
thanks and Greetings,
Emily (12 Replies)
Discussion started by: emily
12 Replies
9. UNIX for Beginners Questions & Answers
Dears,
Need you help with the below file manipulation. I want to split the file into 8 smaller files but without cutting/disturbing the entries (meaning every small file should start with a entry and end with an empty line). It will be helpful if you can provide a one liner command for this... (12 Replies)
Discussion started by: Kamesh G
12 Replies
10. Shell Programming and Scripting
Split large xml into mutiple files and with header and footer in file
tried below
it splits unevenly and also i need help in adding header and footer
command :
csplit -s -k -f my_XML_split.xml extrfile.xml "/<Document>/" {1}
sample xml
<?xml version="1.0" encoding="UTF-8"?><Recipient>... (36 Replies)
Discussion started by: karthik
36 Replies
SPLIT(3) 1 SPLIT(3)
split - Split string into array by regular expression
SYNOPSIS
array split (string $pattern, string $string, [int $limit = -1])
DESCRIPTION
Splits a $string into array by regular expression.
Warning
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
PARAMETERS
o $pattern
- Case sensitive regular expression. If you want to split on any of the characters which are considered special by regular
expressions, you'll need to escape them first. If you think split(3) (or any other regex function, for that matter) is doing some-
thing weird, please read the file regex.7, included in the regex/ subdirectory of the PHP distribution. It's in manpage format, so
you'll want to do something along the lines of man /usr/local/src/regex/regex.7 in order to read it.
o $string
- The input string.
o $limit
- If $limit is set, the returned array will contain a maximum of $limit elements with the last element containing the whole rest
of $string.
RETURN VALUES
Returns an array of strings, each of which is a substring of $string formed by splitting it on boundaries formed by the case-sensitive
regular expression $pattern.
If there are n occurrences of $pattern, the returned array will contain n+1 items. For example, if there is no occurrence of $pattern, an
array with only one element will be returned. Of course, this is also true if $string is empty. If an error occurs, split(3) returns FALSE.
EXAMPLES
Example #1
split(3) example
To split off the first four fields from a line from /etc/passwd:
<?php
list($user, $pass, $uid, $gid, $extra) =
split(":", $passwd_line, 5);
?>
Example #2
split(3) example
To parse a date which may be delimited with slashes, dots, or hyphens:
<?php
// Delimiters may be slash, dot, or hyphen
$date = "04/30/1973";
list($month, $day, $year) = split('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year<br />
";
?>
NOTES
Note
As of PHP 5.3.0, the regex extension is deprecated in favor of the PCRE extension. Calling this function will issue an E_DEPRECATED
notice. See the list of differences for help on converting to PCRE.
Tip
split(3) is deprecated as of PHP 5.3.0. preg_split(3) is the suggested alternative to this function. If you don't require the power
of regular expressions, it is faster to use explode(3), which doesn't incur the overhead of the regular expression engine.
Tip
For users looking for a way to emulate Perl's @chars = split('', $str) behaviour, please see the examples for preg_split(3) or
str_split(3).
SEE ALSO
preg_split(3), spliti(3), str_split(3), explode(3), implode(3), chunk_split(3), wordwrap(3).
PHP Documentation Group SPLIT(3)