I am trying to read a file and split the file into multiple files. I need to create new files with different set of lines from the original file. ie, the first output file may contain 10 lines and the second 100 lines and so on. The criteria is to get the lines between two lines starting with some... (8 Replies)
I have gone through all the threads in the forum and tested out different things. I am trying to split a 3GB file into multiple files. Some files are even larger than this.
For example:
split -l 3000000 filename.txt
This is very slow and it splits the file with 3 million records in each... (10 Replies)
I did a lot of search on this forum on spiting file; found a lot, but my requirement is a bit different, please guide.
Master file:
x:start:5
line1:23
line2:12
2:90
x:end:5
x:start:2
45:56
22:90
x:end:2
x:start:3
line1:23
line2:12
x:end:3
x:start:2
line5:23 (1 Reply)
Hi ,
I just need to split a file and outputfiles are redirected to gzip file
need:
Input file - A.gz
content of A.gz is
100|sfdds|dffdds|200112|sdfdf
100|sfdds|dffdds|200112|sdfdf
100|sfdds|dffdds|200112|sdfdf
100|sfdds|dffdds|200212|sdfdf
100|sfdds|dffdds|200212|sdfdf... (3 Replies)
Hello,
I have a file like the following:
david,a,b,c,20,r
thomas,a,b,c,30,r
willaiam,a,b,c,80,r
barbara,a,b,c,100,r
I would like to split the file into other files using a condition for the contents of column 5.
The condition should be a if the contents of column 5 is in a range... (4 Replies)
Hi All,
Input.txt
XYZONEABC
CZXTWOJJJ
KKKSIXOOO
asdfhajlsdhfajs
asdfasfasdf
Output Files:
ONE.txt
XYZONEABC
TWO.txt
CZXTWOJJJ
SIX.txt
KKKSIXOOO
I had a script (2 Replies)
Hi!
I have a file like this:
a,b,c,12,d,e
a,b,c,13,d,e
a,b,c,14,d,e
a,b,c,15,d,e
a,b,c,16,d,e
a,b,c,17,d,e
I need to split that file in two:
If field 4 is equal or higher than 14 that row goes to one file and if it is equal or higher than 15 to another.
Can anyone point me in the... (2 Replies)
Hi all,
I'm pretty new to Shell scripting and I need some help to split a source text file into multiple files. The source has a row with pattern where the file needs to be split, and the pattern row also contains the file name of the destination for that specific piece. Here is an example:
... (2 Replies)
Hi all,
First of all I' like to mention that I'm pretty new to unix scripting. :(
I'm trying to split an large xml with awk and rename it based on the values of two attributes.
Example XML
<RECORD>
<element1>11</element1>
<element2>22</element2>
<element3>33</element3>... (18 Replies)
Discussion started by: f0usk4s
18 Replies
LEARN ABOUT OSX
split
split(n) Tcl Built-In Commands split(n)
__________________________________________________________________________________________________________________________________________________NAME
split - Split a string into a proper Tcl list
SYNOPSIS
split string ?splitChars?
_________________________________________________________________DESCRIPTION
Returns a list created by splitting string at each character that is in the splitChars argument. Each element of the result list will con-
sist of the characters from string that lie between instances of the characters in splitChars. Empty list elements will be generated if
string contains adjacent characters in splitChars, or if the first or last character of string is in splitChars. If splitChars is an empty
string then each character of string becomes a separate element of the result list. SplitChars defaults to the standard white-space char-
acters.
EXAMPLES
Divide up a USENET group name into its hierarchical components:
split "comp.lang.tcl.announce" .
-> comp lang tcl announce
See how the split command splits on every character in splitChars, which can result in information loss if you are not careful:
split "alpha beta gamma" "temp"
-> al {ha b} {} {a ga} {} a
Extract the list words from a string that is not a well-formed list:
split "Example with {unbalanced brace character"
-> Example with {unbalanced brace character
Split a string into its constituent characters
split "Hello world" {}
-> H e l l o { } w o r l d
PARSING RECORD-ORIENTED FILES
Parse a Unix /etc/passwd file, which consists of one entry per line, with each line consisting of a colon-separated list of fields:
## Read the file
set fid [open /etc/passwd]
set content [read $fid]
close $fid
## Split into records on newlines
set records [split $content "
"]
## Iterate over the records
foreach rec $records {
## Split into fields on colons
set fields [split $rec ":"]
## Assign fields to variables and print some out...
lassign $fields
userName password uid grp longName homeDir shell
puts "$longName uses [file tail $shell] for a login shell"
}
SEE ALSO
join(n), list(n), string(n)
KEYWORDS
list, split, string
Tcl split(n)